Answer the question
In order to leave comments, you need to log in
How to run a Django test project?
Hello!
Help please deal with the problem. There is a test project on Django, written according to some kind of manual. In test mode, everything starts and works.
***@ServerUbuntu:/var/www/mysite$ python3 manage.py runserver 10.8.0.1:8000
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
July 29, 2020 - 08:47:42
Django version 2.2.14, using settings 'mysite.settings'
Starting development server at 10.8.0.1:8000
Quit the server with CONTROL-C.
***@ServerUbuntu:/var/log/apache2$ cat test3.log
[Wed Jul 29 08:40:23.292988 2020] [wsgi:error] [pid 8219] [client 10.8.0.4:64417] mod_wsgi (pid=8219): Target WSGI script '/var/www/mysite/mysite/wsgi.py' cannot be loaded as Python module.
[Wed Jul 29 08:40:23.293123 2020] [wsgi:error] [pid 8219] [client 10.8.0.4:64417] mod_wsgi (pid=8219): Exception occurred processing WSGI script '/var/www/mysite/mysite/wsgi.py'.
[Wed Jul 29 08:40:23.293196 2020] [wsgi:error] [pid 8219] [client 10.8.0.4:64417] Traceback (most recent call last):
[Wed Jul 29 08:40:23.293264 2020] [wsgi:error] [pid 8219] [client 10.8.0.4:64417] File "/var/www/mysite/mysite/wsgi.py", line 4, in
[Wed Jul 29 08:40:23.293453 2020] [wsgi:error] [pid 8219] [client 10.8.0.4:64417] from django.core.wsgi import get_wsgi_application
[Wed Jul 29 08:40:23.293616 2020] [wsgi:error] [pid 8219] [client 10.8.0.4:64417] ImportError: No module named django.core.wsgi
***@ServerUbuntu:/var/log/apache2$ cat /var/www/mysite/mysite/wsgi.py
#!/usr/bin/env python3
import os, sys
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
application = get_wsgi_application()
***@ServerUbuntu:/etc/apache2/sites-available$ cat 000-default.conf
<аVirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
ServerAdmin admin.mysite.com
WSGIScriptAlias / /var/www/mysite/mysite/wsgi.py
Alias /mysite /var/www/mysite
ErrorLog ${APACHE_LOG_DIR}/test3.log
<а/VirtualHost>
<аDirectory /var/www/mysite>
Order allow,deny
<а/Directory>
WSGIPythonHome /usr/local/lib/python3.5/dist-packages
Answer the question
In order to leave comments, you need to log in
Gourii don't use Apache for this.
As for the virtual environment, here is the command to create it under python 3
virtualenv --no-site-packages --python=/usr/bin/python3 --prompt="(<project_name>)" <venv_name>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question