2

Apache内のwsgiを介して、仮想環境内でdjangoアプリをサーバーにしようとしています。しかし、私はエラーが発生します

[Fri Oct 11 18:28:55 2013] [error] [client 86.151.x.x] ImportError: Could not import settings 'myapp.myapp_settings' (Is it on sys.path?): No module named settings

しかし、すべてが順調に見えますが、

/opt/django/webtools_django15/
|-- __init__.py
|-- myapp
|   |-- __init__.py
|   |-- __init__.pyc
|   |-- myapp.wsgi
|   |-- myapp_settings.py
|   |-- myapp_settings.pyc
|   |-- myapp_urls.py
|   |-- forms.py
|   |-- forms.pyc
|   |-- models.py
|   |-- tests.py
|   |-- views.py
|   |-- views.py-bak
|   `-- views.pyc
|-- manage.py
|-- modules
|   `-- dnslookup.py
|-- static
|   !! omitted !!
|-- templates
|   `-- myapp
|       |-- myapp-about.html
|       |-- myapp-base.html
|       |-- myapp-cachecheck-result.html
|       |-- myapp-glossary.html
|       |-- myapp-home.html
|       |-- myapp-input-cachecheck.html
|       |-- myapp-input-cachecheck.html-bak
|       |-- myapp-input-lookup.html
|       |-- myapp-input-lookup.html-bak
|       |-- myapp-input-report.html
|       |-- myapp-input-report.html-bak
|       |-- myapp-lookup-result.html
|       |-- myapp-partners.html
|       |-- myapp-ratelimited.html
|       `-- myapp-report-result.html
`-- webtools_django15
    |-- __init__.py
    |-- __init__.pyc
    |-- settings.py
    |-- settings.py-bak
    |-- settings.pyc
    `-- urls.py

WSGI ファイル

(django15)[root@bob-x django]# cat /opt/django/webtools_django15/myapp/myapp.wsgi
import os
import sys
import site

site.addsitedir("/opt/django/virtenv/django15/lib/python2.7/site-packages/")

from django.core.handlers.wsgi import WSGIHandler
sys.path.append('/opt/django/webtools_django15/')
sys.path.append('/opt/django/')

os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.myapp_settings'
application = WSGIHandler()

アパッチ

<VirtualHost *:80 >
  DocumentRoot /opt/django/webtools_django15/
  ServerName myapp.co.uk
  ServerAlias www.myapp.co.uk direct.myapp.co.uk

  WSGIApplicationGroup myapp
  WSGIScriptAlias / /opt/django/webtools_django15/myapp/myapp.wsgi
  WSGIDaemonProcess myapp processes=5 python-path=/opt/django/webtools_django15:/opt/django/virtenv/django15/lib/python2.7/site-packages/ threads=1

  Alias /static/ /opt/django/webtools_django15/static/
  ErrorLog logs/myapp-error.log
  CustomLog logs/myapp-access.log common
</VirtualHost>

ここで簡単なものが欠けていますか?

ありがとう、

4

1 に答える 1

4

追加で修正

sys.path.append('/opt/django/webtools_django15/webtools_django15')

私のwgsiに..

于 2013-10-11T18:04:45.557 に答える