我正在尝试在django
服务器上运行我的apache
项目。我没有在django
上运行virtualenv
项目。我在views.py
中有以下代码,其中 导入错误 说 没有名为startInsight的模块 强烈>每次。如果我与python manage.py runserver 0.0.0.0:80
一起运行,那就完全一样了。
views.py
中的错误点:
sys.path.insert(0,"/Insight/scripts")
import startInsight
以下是我的配置: -
/etc/apache2/sites-available/000-default.conf:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /web/mysite
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /web/mysite>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
Alias /static /web/mysite/mysite/static
<Directory /web/mysite/mysite/static>
Require all granted
</Directory>
<Directory /web/mysite/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess mysite python-path=/usr/bin/python:/web/mysite
WSGIProcessGroup mysite
WSGIScriptAlias / /web/mysite/mysite/wsgi.py
</VirtualHost>
/web/mysite/mysite/wsgi.py:
import os
'''
I tried adding these two lines below. Did not make a difference.
import sys
sys.path.insert(0,"/Insight/scripts")
'''
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
application = get_wsgi_application()
我不确定我做错了什么,需要一些指导。