I try to deploy Django application under Django 1.8 and Apache mod_wsgi (python 3.4.3, ubuntu 14.04)
I have solved the previous error with import ( Django WSGI deployment. cannot import name 'SimpleCookie' ) but then I meet another one:
Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'
Here bigger piece of the error log:
[Wed Jun 10 18:33:44.021939 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "<frozen importlib._bootstrap>", line 1448, in exec_module
[Wed Jun 10 18:33:44.021960 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
[Wed Jun 10 18:33:44.022198 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "/var/www/.virtualenvs/cp/lib/python3.4/site-packages/django/contrib/auth/models.py", line 41, in <module>
[Wed Jun 10 18:33:44.022207 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] class Permission(models.Model):
[Wed Jun 10 18:33:44.022760 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "/var/www/.virtualenvs/cp/lib/python3.4/site-packages/django/db/models/base.py", line 139, in __new__
[Wed Jun 10 18:33:44.022770 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] new_class.add_to_class('_meta', Options(meta, **kwargs))
[Wed Jun 10 18:33:44.022807 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "/var/www/.virtualenvs/cp/lib/python3.4/site-packages/django/db/models/base.py", line 324, in add_to_class
[Wed Jun 10 18:33:44.022814 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] value.contribute_to_class(cls, name)
[Wed Jun 10 18:33:44.023151 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "/var/www/.virtualenvs/cp/lib/python3.4/site-packages/django/db/models/options.py", line 250, in contribute_to_class
[Wed Jun 10 18:33:44.023161 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
[Wed Jun 10 18:33:44.023296 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "/var/www/.virtualenvs/cp/lib/python3.4/site-packages/django/db/__init__.py", line 36, in __getattr__
[Wed Jun 10 18:33:44.023304 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] return getattr(connections[DEFAULT_DB_ALIAS], item)
[Wed Jun 10 18:33:44.023514 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "/var/www/.virtualenvs/cp/lib/python3.4/site-packages/django/db/utils.py", line 240, in __getitem__
[Wed Jun 10 18:33:44.023558 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] backend = load_backend(db['ENGINE'])
[Wed Jun 10 18:33:44.023603 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "/var/www/.virtualenvs/cp/lib/python3.4/site-packages/django/db/utils.py", line 111, in load_backend
[Wed Jun 10 18:33:44.023610 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] return import_module('%s.base' % backend_name)
[Wed Jun 10 18:33:44.023642 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "/usr/local/lib/python3.4/importlib/__init__.py", line 109, in import_module
[Wed Jun 10 18:33:44.023649 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Jun 10 18:33:44.023669 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "<frozen importlib._bootstrap>", line 2231, in _gcd_import
[Wed Jun 10 18:33:44.023690 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "<frozen importlib._bootstrap>", line 2214, in _find_and_load
[Wed Jun 10 18:33:44.023711 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "<frozen importlib._bootstrap>", line 2203, in _find_and_load_unlocked
[Wed Jun 10 18:33:44.023732 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
[Wed Jun 10 18:33:44.023752 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "<frozen importlib._bootstrap>", line 1129, in _exec
[Wed Jun 10 18:33:44.023773 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "<frozen importlib._bootstrap>", line 1448, in exec_module
[Wed Jun 10 18:33:44.023793 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
[Wed Jun 10 18:33:44.023826 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] File "/var/www/.virtualenvs/cp/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 36, in <module>
[Wed Jun 10 18:33:44.023833 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
[Wed Jun 10 18:33:44.023862 2015] [:error] [pid 19282:tid 140071189554944] [client 192.168.1.1:16780] django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'
When running development server no errors appear. There is no errors as well when running in python interpreter in virtualenv cp
>>>import sqlite3
My wsgi.py file is:
import os, sys, site
sys.path.insert(0,'/var/www/.virtualenvs/cp/lib/python3.4/site-packages')
sys.path.insert(0,'/var/www/django_projects/cp')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
exec(open("/var/www/.virtualenvs/cp/bin/activate_this.py").read())
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Here is Apache's virtualhost's conf for the site:
<VirtualHost *:80>
ServerName cp.mysite.com
WSGIDaemonProcess cp user=www-data group=www-data threads=5
WSGIApplicationGroup cp
WSGIScriptAlias / /var/www/django_projects/cp/mysite/wsgi.py
<Directory /var/www/django_projects/cp/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
ErrorLog /var/www/errlogs/cperror.log
</VirtualHost>
Finaly, after making a debug with a help of simple wsgi.py (thanks to #GrahamDumpleton for the link), I've found that my resulting sys.path is not too clean.
So I have manually changed sys.path in wsgi.py taking it from python started in virtualenv cp and then added project directory to this list at the begining in wsgi.py:
import os, sys
virtual_env = '/var/www/.virtualenvs/cp'
sys.path=['%s/lib/python34.zip' % (virtual_env,),
'%s/lib/python3.4' % (virtual_env,),
'%s/lib/python3.4/plat-linux' % (virtual_env,),
'%s/lib/python3.4/lib-dynload' % (virtual_env,),
'%s/lib/python3.4/site-packages' % (virtual_env,),
#'/var/www/python/3.4.3/lib/python3.4',
]
sys.path.insert(0,'/var/www/django_projects/cp')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Possibly this is not the "best practice" solution, but it does remove magic functions and easy to understand and repeat for new user like me :)
Related
I am trying to host two Django websites on Windows (so no WSGIdaemonprocess). When I did host only one of them it worked perfectly. Now it still works (main path "/" named magazyn). But the second one (path "/awizacje" named awizacje) throws an Internal Server Error. Full error message in Apache logs looks like this:
C:\A\34\s\Modules\_decimal\libmpdec\context.c:57: warning: mpd_setminalloc: ignoring request to set MPD_MINALLOC a second time
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] mod_wsgi (pid=6268): Failed to exec Python script file 'C:/var/www2/awizacje/rootkat/awizacje/wsgi.py'.
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] mod_wsgi (pid=6268): Exception occurred processing WSGI script 'C:/var/www2/awizacje/rootkat/awizacje/wsgi.py'.
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] Traceback (most recent call last):\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "C:/var/www2/awizacje/rootkat/awizacje/wsgi.py", line 19, in <module>\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] application = get_wsgi_application()\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "C:\\var\\www\\magazyn\\env39\\Lib\\site-packages\\django\\core\\wsgi.py", line 12, in get_wsgi_application\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] django.setup(set_prefix=False)\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "C:\\var\\www\\magazyn\\env39\\Lib\\site-packages\\django\\__init__.py", line 19, in setup\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "C:\\var\\www\\magazyn\\env39\\Lib\\site-packages\\django\\conf\\__init__.py", line 76, in __getattr__\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] self._setup(name)\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "C:\\var\\www\\magazyn\\env39\\Lib\\site-packages\\django\\conf\\__init__.py", line 63, in _setup\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] self._wrapped = Settings(settings_module)\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "C:\\var\\www\\magazyn\\env39\\Lib\\site-packages\\django\\conf\\__init__.py", line 142, in __init__\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] mod = importlib.import_module(self.SETTINGS_MODULE)\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "C:\\Python39\\lib\\importlib\\__init__.py", line 127, in import_module\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] return _bootstrap._gcd_import(name[level:], package, level)\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "<frozen importlib._bootstrap>", line 1030, in _gcd_import\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "<frozen importlib._bootstrap>", line 1007, in _find_and_load\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "<frozen importlib._bootstrap>", line 1030, in _gcd_import\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "<frozen importlib._bootstrap>", line 1007, in _find_and_load\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked\r
[Mon Oct 11 14:57:35.251409 2021] [wsgi:error] [pid 6268:tid 992] [client 192.168.2.54:25532] ModuleNotFoundError: No module named 'awizacje'\r
My httpd.conf looks like this:
WSGIPythonHome "C:/var/www/magazyn/env39"
WSGIPythonPath "C:/var/www/magazyn/venv/Lib/site-packages;C:/var/www/magazyn/rootkat/"
ServerName www.magazyn-stolarz.pl
LoadFile "C:/Python39/python39.dll"
LoadModule wsgi_module "C:/var/www/magazyn/env39/lib/site-packages/mod_wsgi/server/mod_wsgi.cp39-win_amd64.pyd"
WSGIScriptAlias /awizacje "C:/var/www2/awizacje/rootkat/awizacje/wsgi.py"
WSGIScriptAlias / "C:/var/www/magazyn/rootkat/magazyn/wsgi.py"
<Directory "C:/var/www/magazyn/rootkat/magazyn/">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static "C:/var/www/static/"
<Directory "C:/var/www/static/">
Require all granted
</Directory>
<Directory "C:/var/www2/awizacje/rootkat/awizacje/">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /statica "C:/var/www2/static/"
<Directory "C:/var/www2/static/">
Require all granted
</Directory>
My wsgi.py settings in 'awizacje' project:
"""
WSGI config for magazyn project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
import sys
import site
from django.core.wsgi import get_wsgi_application
#os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'awizacje.settings')
os.environ["DJANGO_SETTINGS_MODULE"] = "awizacje.settings"
application = get_wsgi_application()
site.addsitedir('C:/var/www2/awizacje/venv/Lib/site-packages')
sys.path.append('C:/var/www2/awizacje')
sys.path.append('C:/var/www2/awizacje/rootkat')
What am I doing wrong? I sadly can't use Linux which would be pretty straightforward.
It looks like what I was missing was appending directories BEFORE get_wsgi_application() command in wsgi.py
"""
WSGI config for magazyn project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
import sys
import site
from django.core.wsgi import get_wsgi_application
#os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'awizacje.settings')
os.environ["DJANGO_SETTINGS_MODULE"] = "awizacje.settings"
application = get_wsgi_application()
site.addsitedir('C:/var/www2/awizacje/venv/Lib/site-packages')
sys.path.append('C:/var/www2/awizacje')
sys.path.append('C:/var/www2/awizacje/rootkat')
i followed AWS tutorial for django lightsail instance: https://aws.amazon.com/es/getting-started/hands-on/deploy-python-application/
i tried to deploy my own code but apache gives me errors on piped installed modules.
It seems that instance have different paths. Some one has deployed custom django projects on django lightsail instance?
[Sun Aug 16 22:58:29.402644 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] mod_wsgi (pid=4065): Exception occurred processing WSGI script '/opt/bitnami/apps/django/django_projects/orderbot/ordermenu/wsgi.py'.
[Sun Aug 16 22:58:29.403437 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] Traceback (most recent call last):
[Sun Aug 16 22:58:29.403493 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/apps/django/django_projects/orderbot/ordermenu/wsgi.py", line 22, in <module>
[Sun Aug 16 22:58:29.403504 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] application = get_wsgi_application()
[Sun Aug 16 22:58:29.403515 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Sun Aug 16 22:58:29.403521 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] django.setup(set_prefix=False)
[Sun Aug 16 22:58:29.403530 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
[Sun Aug 16 22:58:29.403535 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] apps.populate(settings.INSTALLED_APPS)
[Sun Aug 16 22:58:29.403544 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
[Sun Aug 16 22:58:29.403549 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] app_config = AppConfig.create(entry)
[Sun Aug 16 22:58:29.403558 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/site-packages/django/apps/config.py", line 90, in create
[Sun Aug 16 22:58:29.403563 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] module = import_module(entry)
[Sun Aug 16 22:58:29.403571 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "/opt/bitnami/python/lib/python3.8/importlib/__init__.py", line 127, in import_module
[Sun Aug 16 22:58:29.403578 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] return _bootstrap._gcd_import(name[level:], package, level)
[Sun Aug 16 22:58:29.403587 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
[Sun Aug 16 22:58:29.403596 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "<frozen importlib._bootstrap>", line 991, in _find_and_load
[Sun Aug 16 22:58:29.403606 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
[Sun Aug 16 22:58:29.403626 2020] [wsgi:error] [pid 4065] [client 177.240.102.67:65250] ModuleNotFoundError: No module named 'phonenumber_field'
The problem is that 'python install packages in a directory that apache do not see'.
so: packages get installed in '/home/bitnami/.local/lib/python3.8/site-packages/' and Apache looks in '/opt/bitnami/python/lib/python3.8/site-packages/'.
The temporary solution I followed is copying packages to Apache eyes folder with this command 'cp -r /home/bitnami/.local/lib/python3.8/site-packages/* /opt/bitnami/python/lib/python3.8/site-packages/'
Just needed to use the root user with sudo su command for pip install packages, now are found by apache.
I am trying to start my first django app with Apache2 (2.4.18).
Unfortunately, I got a bit stuck. This is the error code i get in my log file:
[Wed Mar 11 06:31:32.668937 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] mod_wsgi (pid=14849): Target WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py' cannot be loaded as Python module.
[Wed Mar 11 06:31:32.669026 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] mod_wsgi (pid=14849): Exception occurred processing WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py'.
[Wed Mar 11 06:31:32.669734 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] Traceback (most recent call last):
[Wed Mar 11 06:31:32.669779 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/home/nigsdtm/srv/portal/mysite/wsgi.py", line 16, in <module>
[Wed Mar 11 06:31:32.669783 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] application = get_wsgi_application()
[Wed Mar 11 06:31:32.669789 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Mar 11 06:31:32.669792 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] django.setup(set_prefix=False)
[Wed Mar 11 06:31:32.669809 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 24, in setup
[Wed Mar 11 06:31:32.669812 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] apps.populate(settings.INSTALLED_APPS)
[Wed Mar 11 06:31:32.669817 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 112, in populate
[Wed Mar 11 06:31:32.669820 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] app_config.import_models()
[Wed Mar 11 06:31:32.669824 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/django/apps/config.py", line 198, in import_models
[Wed Mar 11 06:31:32.669827 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] self.models_module = import_module(models_module_name)
[Wed Mar 11 06:31:32.669832 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
[Wed Mar 11 06:31:32.669834 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Mar 11 06:31:32.669839 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 986, in _gcd_import
[Wed Mar 11 06:31:32.669843 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 969, in _find_and_load
[Wed Mar 11 06:31:32.669848 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
[Wed Mar 11 06:31:32.669852 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
[Wed Mar 11 06:31:32.669857 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap_external>", line 665, in exec_module
[Wed Mar 11 06:31:32.669861 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
[Wed Mar 11 06:31:32.669866 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/polls/models.py", line 14, in <module>
[Wed Mar 11 06:31:32.669869 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] class Choice(models.Model):
[Wed Mar 11 06:31:32.669873 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] File "/usr/local/lib/python3.5/dist-packages/polls/models.py", line 15, in Choice
[Wed Mar 11 06:31:32.669886 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] question = models.ForeignKey(Question)
[Wed Mar 11 06:31:32.669900 2020] [wsgi:error] [pid 14849:tid 140433834096384] [remote 10.150.29.220:33874] TypeError: __init__() missing 1 required positional argument: 'on_delete'
[Wed Mar 11 06:31:47.868251 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] mod_wsgi (pid=15027): Target WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py' cannot be loaded as Python module.
[Wed Mar 11 06:31:47.868326 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] mod_wsgi (pid=15027): Exception occurred processing WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py'.
[Wed Mar 11 06:31:47.869029 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] Traceback (most recent call last):
[Wed Mar 11 06:31:47.869078 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/home/nigsdtm/srv/portal/mysite/wsgi.py", line 16, in <module>
[Wed Mar 11 06:31:47.869082 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] application = get_wsgi_application()
[Wed Mar 11 06:31:47.869087 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Mar 11 06:31:47.869090 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] django.setup(set_prefix=False)
[Wed Mar 11 06:31:47.869098 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 24, in setup
[Wed Mar 11 06:31:47.869101 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] apps.populate(settings.INSTALLED_APPS)
[Wed Mar 11 06:31:47.869105 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 112, in populate
[Wed Mar 11 06:31:47.869108 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] app_config.import_models()
[Wed Mar 11 06:31:47.869112 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/django/apps/config.py", line 198, in import_models
[Wed Mar 11 06:31:47.869115 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] self.models_module = import_module(models_module_name)
[Wed Mar 11 06:31:47.869119 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
[Wed Mar 11 06:31:47.869122 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Mar 11 06:31:47.869127 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 986, in _gcd_import
[Wed Mar 11 06:31:47.869132 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 969, in _find_and_load
[Wed Mar 11 06:31:47.869136 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
[Wed Mar 11 06:31:47.869141 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
[Wed Mar 11 06:31:47.869146 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap_external>", line 665, in exec_module
[Wed Mar 11 06:31:47.869158 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
[Wed Mar 11 06:31:47.869163 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/polls/models.py", line 14, in <module>
[Wed Mar 11 06:31:47.869166 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] class Choice(models.Model):
[Wed Mar 11 06:31:47.869170 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] File "/usr/local/lib/python3.5/dist-packages/polls/models.py", line 15, in Choice
[Wed Mar 11 06:31:47.869172 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] question = models.ForeignKey(Question)
[Wed Mar 11 06:31:47.869186 2020] [wsgi:error] [pid 15027:tid 140380136130304] [remote 10.150.29.220:57041] TypeError: __init__() missing 1 required positional argument: 'on_delete'
[Wed Mar 11 06:31:48.530646 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] mod_wsgi (pid=15027): Target WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py' cannot be loaded as Python module.
[Wed Mar 11 06:31:48.530748 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] mod_wsgi (pid=15027): Exception occurred processing WSGI script '/home/nigsdtm/srv/portal/mysite/wsgi.py'.
[Wed Mar 11 06:31:48.530861 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] Traceback (most recent call last):
[Wed Mar 11 06:31:48.530888 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/home/nigsdtm/srv/portal/mysite/wsgi.py", line 16, in <module>
[Wed Mar 11 06:31:48.530891 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] application = get_wsgi_application()
[Wed Mar 11 06:31:48.530897 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Mar 11 06:31:48.530897 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/usr/local/lib/python3.5/dist-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Mar 11 06:31:48.530899 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] django.setup(set_prefix=False)
[Wed Mar 11 06:31:48.530904 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/usr/local/lib/python3.5/dist-packages/django/__init__.py", line 24, in setup
[Wed Mar 11 06:31:48.530907 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] apps.populate(settings.INSTALLED_APPS)
[Wed Mar 11 06:31:48.530911 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] File "/usr/local/lib/python3.5/dist-packages/django/apps/registry.py", line 81, in populate
[Wed Mar 11 06:31:48.530914 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] raise RuntimeError("populate() isn't reentrant")
[Wed Mar 11 06:31:48.530927 2020] [wsgi:error] [pid 15027:tid 140380018607872] [remote 10.150.29.220:42180] RuntimeError: populate() isn't reentrant
This is my apache2 config file:
Listen 80
<VirtualHost *:80>
ServerAdmin alexandru.bran#nokia.com
ServerName app.gdceur.eecloud.dynamic.nsn-net.net
DocumentRoot /home/nigsdtm/srv
Alias /static /home/nigsdtm/srv/portal/mysite/static
<Directory "/home/nigsdtm/srv/portal/mysite/static">
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/portal_error.log
CustomLog ${APACHE_LOG_DIR}/portal_access.log combined
WSGIDaemonProcess mysite python-home=/home/nigsdtm/srv/portal/ python-path=/home/nigsdtm/srv/portal/venv
WSGIProcessGroup mysite
WSGIScriptAlias / /home/nigsdtm/srv/portal/mysite/wsgi.py
<Directory /home/nigsdtm/srv/portal/mysite>
<Files wsgi.py>
Allow from all
</Files>
</Directory>
</VirtualHost>
This is my wsgi file:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
application = get_wsgi_application()
Project folder name (where manage.py is) is called 'portal'
Folder containing wsgi: 'mysite'
App works if I run server from python environment.
I am running Django 2.1.15 with Python 3.5.2
Could you please give me a hint?
Thanks,
Alexandru
I see this line of error:
TypeError: __init__() missing 1 required positional argument: 'on_delete'
This one I recognized as a missing on_delete statement in a ForeignKey attribute.
According to Django2 changelog:
The on_delete argument for ForeignKey and OneToOneField is now required in models and migrations. Consider squashing migrations so that you have fewer of them to update.
You might have developed your application on Django1 and trying to deploy it with Django2.
You should check that you installed the same dependencies on your production server than on your development machine.
I'm tryign to get a Django application with Python 3.7 working with CentOS 7 and Apache (Mod WSGI). I have a project with a virtual environment set up. How do I turn off SqlLite? I'm not and don't intend to ever use it. I tried running
(dentalenv) [root#server Python-3.7.2]# sudo yum install libsqlite3-dev
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.us-midwest-1.nexcess.net
* epel: mirror.steadfastnet.com
* extras: mirror.us-midwest-1.nexcess.net
* updates: mirror.us-midwest-1.nexcess.net
No package libsqlite3-dev available.
Error: Nothing to do
to install it and then restarting my Apache server. I even rebuilt Python, but I still get the below error, "ModuleNotFoundError: No module named '_sqlite3'"
[Wed Feb 20 04:03:06.627020 2019] [wsgi:error] [pid 11885] Traceback (most recent call last):
[Wed Feb 20 04:03:06.627285 2019] [wsgi:error] [pid 11885] File "/var/www/html/dental/wsgi.py", line 25, in <module>
[Wed Feb 20 04:03:06.627323 2019] [wsgi:error] [pid 11885] application = get_wsgi_application()
[Wed Feb 20 04:03:06.627353 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Wed Feb 20 04:03:06.627378 2019] [wsgi:error] [pid 11885] django.setup(set_prefix=False)
[Wed Feb 20 04:03:06.627405 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
[Wed Feb 20 04:03:06.627429 2019] [wsgi:error] [pid 11885] apps.populate(settings.INSTALLED_APPS)
[Wed Feb 20 04:03:06.627467 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/apps/registry.py", line 112, in populate
[Wed Feb 20 04:03:06.627493 2019] [wsgi:error] [pid 11885] app_config.import_models()
[Wed Feb 20 04:03:06.627520 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/apps/config.py", line 198, in import_models
[Wed Feb 20 04:03:06.627544 2019] [wsgi:error] [pid 11885] self.models_module = import_module(models_module_name)
[Wed Feb 20 04:03:06.627571 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Wed Feb 20 04:03:06.627608 2019] [wsgi:error] [pid 11885] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Feb 20 04:03:06.627636 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
[Wed Feb 20 04:03:06.627666 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 983, in _find_and_load
[Wed Feb 20 04:03:06.627695 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
[Wed Feb 20 04:03:06.627724 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
[Wed Feb 20 04:03:06.627754 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap_external>", line 728, in exec_module
[Wed Feb 20 04:03:06.627783 2019] [wsgi:error] [pid 11885] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[Wed Feb 20 04:03:06.627812 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in <module>
[Wed Feb 20 04:03:06.627835 2019] [wsgi:error] [pid 11885] from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
[Wed Feb 20 04:03:06.627861 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in <module>
[Wed Feb 20 04:03:06.627884 2019] [wsgi:error] [pid 11885] class AbstractBaseUser(models.Model):
[Wed Feb 20 04:03:06.627910 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/models/base.py", line 101, in __new__
[Wed Feb 20 04:03:06.627933 2019] [wsgi:error] [pid 11885] new_class.add_to_class('_meta', Options(meta, app_label))
[Wed Feb 20 04:03:06.627958 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/models/base.py", line 305, in add_to_class
[Wed Feb 20 04:03:06.627981 2019] [wsgi:error] [pid 11885] value.contribute_to_class(cls, name)
[Wed Feb 20 04:03:06.628008 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/models/options.py", line 203, in contribute_to_class
[Wed Feb 20 04:03:06.628031 2019] [wsgi:error] [pid 11885] self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
[Wed Feb 20 04:03:06.628058 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/__init__.py", line 33, in __getattr__
[Wed Feb 20 04:03:06.628081 2019] [wsgi:error] [pid 11885] return getattr(connections[DEFAULT_DB_ALIAS], item)
[Wed Feb 20 04:03:06.628107 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/utils.py", line 202, in __getitem__
[Wed Feb 20 04:03:06.628132 2019] [wsgi:error] [pid 11885] backend = load_backend(db['ENGINE'])
[Wed Feb 20 04:03:06.628159 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/utils.py", line 110, in load_backend
[Wed Feb 20 04:03:06.628193 2019] [wsgi:error] [pid 11885] return import_module('%s.base' % backend_name)
[Wed Feb 20 04:03:06.628222 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/importlib/__init__.py", line 127, in import_module
[Wed Feb 20 04:03:06.628243 2019] [wsgi:error] [pid 11885] return _bootstrap._gcd_import(name[level:], package, level)
[Wed Feb 20 04:03:06.628264 2019] [wsgi:error] [pid 11885] File "/var/www/html/dentalenv/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 10, in <module>
[Wed Feb 20 04:03:06.628283 2019] [wsgi:error] [pid 11885] from sqlite3 import dbapi2 as Database
[Wed Feb 20 04:03:06.628304 2019] [wsgi:error] [pid 11885] File "/usr/local/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
[Wed Feb 20 04:03:06.628323 2019] [wsgi:error] [pid 11885] from sqlite3.dbapi2 import *
[Wed Feb 20 04:03:06.628344 2019] [wsgi:error] [pid 11885] File "/usr/local/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
[Wed Feb 20 04:03:06.628369 2019] [wsgi:error] [pid 11885] from _sqlite3 import *
[Wed Feb 20 04:03:06.628408 2019] [wsgi:error] [pid 11885] ModuleNotFoundError: No module named '_sqlite3'
[Wed Feb 20 04:03:09.130480 2019] [wsgi:error] [pid 11885] [remote 207.181.224.155:58106] mod_wsgi (pid=11885): Target WSGI script '/var/www/html/dental/wsgi.py' does not contain WSGI application 'application'.
hey I'm trying to deploy my first django app on aws beanstalk
but I'm getting an :
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root#localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
I'm following this tutorial:
https://realpython.com/deploying-a-django-app-to-aws-elastic-beanstalk/
I use python 3.6 and django 1.11
I just create a blank django project
part of log
-------------------------------------
/var/log/httpd/error_log
-------------------------------------
[Mon May 21 18:37:58.898238 2018] [:error] [pid 3353] [remote 172.31.30.216:17272] ModuleNotFoundError: No module named 'alpha_app.settings'
[Mon May 21 18:38:13.914282 2018] [:error] [pid 3353] [remote 172.31.30.216:120] mod_wsgi (pid=3353): Target WSGI script '/opt/python/current/app/alpha_app/alpha_app/wsgi.py' cannot be loaded as Python module.
[Mon May 21 18:38:13.914343 2018] [:error] [pid 3353] [remote 172.31.30.216:120] mod_wsgi (pid=3353): Exception occurred processing WSGI script '/opt/python/current/app/alpha_app/alpha_app/wsgi.py'.
[Mon May 21 18:38:13.914484 2018] [:error] [pid 3353] [remote 172.31.30.216:120] Traceback (most recent call last):
[Mon May 21 18:38:13.914527 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "/opt/python/current/app/alpha_app/alpha_app/wsgi.py", line 16, in <module>
[Mon May 21 18:38:13.914531 2018] [:error] [pid 3353] [remote 172.31.30.216:120] application = get_wsgi_application()
[Mon May 21 18:38:13.914547 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Mon May 21 18:38:13.914550 2018] [:error] [pid 3353] [remote 172.31.30.216:120] django.setup(set_prefix=False)
[Mon May 21 18:38:13.914556 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/__init__.py", line 22, in setup
[Mon May 21 18:38:13.914559 2018] [:error] [pid 3353] [remote 172.31.30.216:120] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Mon May 21 18:38:13.914563 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
[Mon May 21 18:38:13.914566 2018] [:error] [pid 3353] [remote 172.31.30.216:120] self._setup(name)
[Mon May 21 18:38:13.914571 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup
[Mon May 21 18:38:13.914574 2018] [:error] [pid 3353] [remote 172.31.30.216:120] self._wrapped = Settings(settings_module)
[Mon May 21 18:38:13.914578 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "/opt/python/run/venv/local/lib/python3.6/site-packages/django/conf/__init__.py", line 110, in __init__
[Mon May 21 18:38:13.914581 2018] [:error] [pid 3353] [remote 172.31.30.216:120] mod = importlib.import_module(self.SETTINGS_MODULE)
[Mon May 21 18:38:13.914585 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "/opt/python/run/venv/lib64/python3.6/importlib/__init__.py", line 126, in import_module
[Mon May 21 18:38:13.914588 2018] [:error] [pid 3353] [remote 172.31.30.216:120] return _bootstrap._gcd_import(name[level:], package, level)
[Mon May 21 18:38:13.914593 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "<frozen importlib._bootstrap>", line 994, in _gcd_import
[Mon May 21 18:38:13.914598 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
[Mon May 21 18:38:13.914602 2018] [:error] [pid 3353] [remote 172.31.30.216:120] File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
[Mon May 21 18:38:13.914617 2018] [:error] [pid 3353] [remote 172.31.30.216:120] ModuleNotFoundError: No module named 'alpha_app.settings'
I think this error comes from the wsgi.py file
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "alpha_app.settings")
but i have no clue how to fix it
I have found the solution to my own problem.
I forgot to make an extra folder named .ebextensions
and kept everything in the folder .elasticbeanstalk
Apparently I can not read.
I just hope my mistake can save someone hours.