beanstalk django http5xx error - django

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.

Related

Failed to import pip modules on aws bitnami django lightsail instance

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.

Django WSGI cannot be loaded

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.

How do I tell Django to never use (and totally ignore) SqlLite?

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'.

Django cannot import name _imaging

I'm trying to deploy a Django application, however, during deployment, I'm getting the following error:
[Mon Feb 12 20:56:17.256427 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] mod_wsgi (pid=6870): Exception occurred processing WSGI script '/home/websites/www-davixxa/src/davixxa_website/production.wsgi'.
[Mon Feb 12 20:56:17.256883 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] Traceback (most recent call last):
[Mon Feb 12 20:56:17.257362 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/PIL/Image.py", line 58, in <module>
[Mon Feb 12 20:56:17.257483 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 134, in get_response
[Mon Feb 12 20:56:17.257492 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] from . import _imaging as core
[Mon Feb 12 20:56:17.257519 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] resolver_match = resolver.resolve(request.path_info)
[Mon Feb 12 20:56:17.257624 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] ImportError: cannot import name '_imaging'
[Mon Feb 12 20:56:17.257760 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512]
[Mon Feb 12 20:56:17.257864 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/urlresolvers.py", line 374, in resolve
[Mon Feb 12 20:56:17.257872 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] During handling of the above exception, another exception occurred:
[Mon Feb 12 20:56:17.257896 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] for pattern in self.url_patterns:
[Mon Feb 12 20:56:17.257905 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512]
[Mon Feb 12 20:56:17.258021 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] Traceback (most recent call last):
[Mon Feb 12 20:56:17.258113 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/utils/functional.py", line 33, in __get__
[Mon Feb 12 20:56:17.258224 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] res = instance.__dict__[self.name] = self.func(instance)
[Mon Feb 12 20:56:17.258537 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
[Mon Feb 12 20:56:17.258855 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Mon Feb 12 20:56:17.259248 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 177, in __call__
[Mon Feb 12 20:56:17.259357 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/utils/functional.py", line 33, in __get__
[Mon Feb 12 20:56:17.259365 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] response = self.get_response(request)
[Mon Feb 12 20:56:17.259390 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] res = instance.__dict__[self.name] = self.func(instance)
[Mon Feb 12 20:56:17.259644 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 230, in get_response
[Mon Feb 12 20:56:17.259745 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
[Mon Feb 12 20:56:17.259756 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Mon Feb 12 20:56:17.259778 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] return import_module(self.urlconf_name)
[Mon Feb 12 20:56:17.260018 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 292, in handle_uncaught_exception
[Mon Feb 12 20:56:17.260108 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
[Mon Feb 12 20:56:17.260118 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] if resolver.urlconf_module is None:
[Mon Feb 12 20:56:17.260140 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] return _bootstrap._gcd_import(name[level:], package, level)
[Mon Feb 12 20:56:17.260285 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
[Mon Feb 12 20:56:17.260376 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/utils/functional.py", line 33, in __get__
[Mon Feb 12 20:56:17.260463 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
[Mon Feb 12 20:56:17.260474 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] res = instance.__dict__[self.name] = self.func(instance)
[Mon Feb 12 20:56:17.260567 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
[Mon Feb 12 20:56:17.260702 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
[Mon Feb 12 20:56:17.260793 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
[Mon Feb 12 20:56:17.260881 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1129, in _exec
[Mon Feb 12 20:56:17.260889 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] return import_module(self.urlconf_name)
[Mon Feb 12 20:56:17.260983 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1471, in exec_module
[Mon Feb 12 20:56:17.261126 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
[Mon Feb 12 20:56:17.261219 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
[Mon Feb 12 20:56:17.261284 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] return _bootstrap._gcd_import(name[level:], package, level)
[Mon Feb 12 20:56:17.261373 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/src/davixxa_website/urls.py", line 24, in <module>
[Mon Feb 12 20:56:17.261465 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
[Mon Feb 12 20:56:17.261473 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] url(r'^markdownx/', include('markdownx.urls')),
[Mon Feb 12 20:56:17.261570 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
[Mon Feb 12 20:56:17.261717 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
[Mon Feb 12 20:56:17.261811 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/conf/urls/__init__.py", line 52, in include
[Mon Feb 12 20:56:17.261902 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
[Mon Feb 12 20:56:17.261910 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] urlconf_module = import_module(urlconf_module)
[Mon Feb 12 20:56:17.262005 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 1129, in _exec
[Mon Feb 12 20:56:17.262135 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 1471, in exec_module
[Mon Feb 12 20:56:17.262223 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
[Mon Feb 12 20:56:17.262310 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
[Mon Feb 12 20:56:17.262318 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] return _bootstrap._gcd_import(name[level:], package, level)
[Mon Feb 12 20:56:17.262464 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
[Mon Feb 12 20:56:17.262553 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/src/davixxa_website/urls.py", line 24, in <module>
[Mon Feb 12 20:56:17.262639 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
[Mon Feb 12 20:56:17.262648 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] url(r'^markdownx/', include('markdownx.urls')),
[Mon Feb 12 20:56:17.262740 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
[Mon Feb 12 20:56:17.262872 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
[Mon Feb 12 20:56:17.262960 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/conf/urls/__init__.py", line 52, in include
[Mon Feb 12 20:56:17.263047 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1129, in _exec
[Mon Feb 12 20:56:17.263056 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] urlconf_module = import_module(urlconf_module)
[Mon Feb 12 20:56:17.263148 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1471, in exec_module
[Mon Feb 12 20:56:17.263281 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
[Mon Feb 12 20:56:17.263367 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
[Mon Feb 12 20:56:17.263430 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] return _bootstrap._gcd_import(name[level:], package, level)
[Mon Feb 12 20:56:17.263521 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/urls.py", line 9, in <module>
[Mon Feb 12 20:56:17.263668 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from .views import (
[Mon Feb 12 20:56:17.263659 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
[Mon Feb 12 20:56:17.263833 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
[Mon Feb 12 20:56:17.263927 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/views.py", line 5, in <module>
[Mon Feb 12 20:56:17.264018 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
[Mon Feb 12 20:56:17.264026 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from .forms import ImageForm
[Mon Feb 12 20:56:17.264122 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
[Mon Feb 12 20:56:17.264258 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 1129, in _exec
[Mon Feb 12 20:56:17.264348 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/forms.py", line 13, in <module>
[Mon Feb 12 20:56:17.264436 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 1471, in exec_module
[Mon Feb 12 20:56:17.264445 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from .utils import scale_and_crop, xml_has_javascript
[Mon Feb 12 20:56:17.264537 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
[Mon Feb 12 20:56:17.264720 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/utils.py", line 3, in <module>
[Mon Feb 12 20:56:17.264805 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/urls.py", line 9, in <module>
[Mon Feb 12 20:56:17.264812 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from PIL import Image
[Mon Feb 12 20:56:17.264834 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] from .views import (
[Mon Feb 12 20:56:17.265016 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/PIL/Image.py", line 58, in <module>
[Mon Feb 12 20:56:17.265100 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/views.py", line 5, in <module>
[Mon Feb 12 20:56:17.265108 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from . import _imaging as core
[Mon Feb 12 20:56:17.265132 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] from .forms import ImageForm
[Mon Feb 12 20:56:17.265229 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] ImportError: cannot import name '_imaging'
[Mon Feb 12 20:56:17.265350 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179]
[Mon Feb 12 20:56:17.265445 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/forms.py", line 13, in <module>
[Mon Feb 12 20:56:17.265453 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] During handling of the above exception, another exception occurred:
[Mon Feb 12 20:56:17.265477 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] from .utils import scale_and_crop, xml_has_javascript
[Mon Feb 12 20:56:17.265518 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179]
[Mon Feb 12 20:56:17.265640 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] Traceback (most recent call last):
[Mon Feb 12 20:56:17.265734 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/utils.py", line 3, in <module>
[Mon Feb 12 20:56:17.265819 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] from PIL import Image
[Mon Feb 12 20:56:17.265910 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 177, in __call__
[Mon Feb 12 20:56:17.265976 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] response = self.get_response(request)
[Mon Feb 12 20:56:17.266065 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/PIL/Image.py", line 58, in <module>
[Mon Feb 12 20:56:17.266125 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] from . import _imaging as core
[Mon Feb 12 20:56:17.266212 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 230, in get_response
[Mon Feb 12 20:56:17.266307 2018] [wsgi:error] [pid 6870:tid 126523728705280] [remote 178.155.217.10:512] ImportError: cannot import name '_imaging'
[Mon Feb 12 20:56:17.266315 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Mon Feb 12 20:56:17.267815 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 292, in handle_uncaught_exception
[Mon Feb 12 20:56:17.267894 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] if resolver.urlconf_module is None:
[Mon Feb 12 20:56:17.268181 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/utils/functional.py", line 33, in __get__
[Mon Feb 12 20:56:17.268237 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] res = instance.__dict__[self.name] = self.func(instance)
[Mon Feb 12 20:56:17.268500 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
[Mon Feb 12 20:56:17.268548 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] return import_module(self.urlconf_name)
[Mon Feb 12 20:56:17.268701 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
[Mon Feb 12 20:56:17.268732 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] return _bootstrap._gcd_import(name[level:], package, level)
[Mon Feb 12 20:56:17.268828 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
[Mon Feb 12 20:56:17.268917 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
[Mon Feb 12 20:56:17.269004 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
[Mon Feb 12 20:56:17.269132 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
[Mon Feb 12 20:56:17.269224 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1129, in _exec
[Mon Feb 12 20:56:17.269313 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1471, in exec_module
[Mon Feb 12 20:56:17.269403 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
[Mon Feb 12 20:56:17.269546 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/src/davixxa_website/urls.py", line 24, in <module>
[Mon Feb 12 20:56:17.269575 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] url(r'^markdownx/', include('markdownx.urls')),
[Mon Feb 12 20:56:17.269708 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/django/conf/urls/__init__.py", line 52, in include
[Mon Feb 12 20:56:17.269737 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] urlconf_module = import_module(urlconf_module)
[Mon Feb 12 20:56:17.269862 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module
[Mon Feb 12 20:56:17.269889 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] return _bootstrap._gcd_import(name[level:], package, level)
[Mon Feb 12 20:56:17.269980 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
[Mon Feb 12 20:56:17.270067 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
[Mon Feb 12 20:56:17.270154 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
[Mon Feb 12 20:56:17.270241 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
[Mon Feb 12 20:56:17.270327 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1129, in _exec
[Mon Feb 12 20:56:17.270413 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 1471, in exec_module
[Mon Feb 12 20:56:17.270500 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
[Mon Feb 12 20:56:17.270637 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/urls.py", line 9, in <module>
[Mon Feb 12 20:56:17.270665 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from .views import (
[Mon Feb 12 20:56:17.270794 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/views.py", line 5, in <module>
[Mon Feb 12 20:56:17.270822 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from .forms import ImageForm
[Mon Feb 12 20:56:17.270950 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/forms.py", line 13, in <module>
[Mon Feb 12 20:56:17.271006 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from .utils import scale_and_crop, xml_has_javascript
[Mon Feb 12 20:56:17.271147 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/markdownx/utils.py", line 3, in <module>
[Mon Feb 12 20:56:17.271185 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from PIL import Image
[Mon Feb 12 20:56:17.271345 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] File "/home/websites/www-davixxa/venv/lib/python3.5/site-packages/PIL/Image.py", line 58, in <module>
[Mon Feb 12 20:56:17.271376 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] from . import _imaging as core
[Mon Feb 12 20:56:17.271479 2018] [wsgi:error] [pid 6870:tid 126523603367680] [remote 178.155.217.10:1179] ImportError: cannot import name '_imaging'
Any help would be greatly appreciated.
Edit: As elaborated on in the comments below, currently, it seems like mod_wsgi isn't compiled for 3.5, but 3.4 instead. I've also gone ahead and expanded my error.

Django WSGI deployment. No module named '_sqlite3'

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 :)