Python\Django deployment with Jelastic cloud

i try to deploy an app on Jelastic cloud without success. I have a generic error message "RuntimeError: populate() isn't reentrant" and i'm not allowed to modify "django/apps/registry.py" for more details. This project run with manage.py

Structure of my project:

ROOT
|_wsgi.py
|_requirements.txt
|_monprojet
   |_monapplication
      |_ ...
   |_manage.py
   |_monprojet
      |_settings.py
      |_ ...

WSGI.PY

virtenv = os.path.expanduser('~') + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
    if sys.version.split(' ')[0].split('.')[0] == '3':
        exec(compile(open(virtualenv, "rb").read(), virtualenv, 'exec'), dict(__file__=virtualenv))
    else:
        execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
    pass
sys.path.append(os.path.expanduser('~'))
sys.path.append(os.path.expanduser('~') + '/ROOT/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'ROOT.monprojet.monprojet.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

settings.py extract :

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'monapplication',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'monprojet.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'monprojet.wsgi.application'

Thanks

You should set WSGI_APPLICATION = 'monprojet.wsgi.application' in your settings, i.e. the same level path as URL conf.

Found it )

The default name for the virtual env is 'virtenv' but your env is "venv"

virtenv = os.path.expanduser('~') + '/venv/' virtualenv = os.path.join(virtenv, 'bin/activate_this.py'

If you choose to keep 'venv' you need to modify path.join & adapt the path in the wsgi.conf file as well

Back to Top