简体   繁体   中英

Python3.5 no module in wsgi

i'm tring to deploy wsgi application which was build-ed using django but when i try to go to page which should serve me django page i got 500 error and in error_log i can see

mod_wsgi (pid=1421): Failed to exec Python script file '/var/www/html/celery/vcs_celery/parsing_hub/parsing_hub/wsgi.py'.
mod_wsgi (pid=1421): Exception occurred processing WSGI script '/var/www/html/celery/vcs_celery/parsing_hub/parsing_hub/wsgi.py'.
Traceback (most recent call last):
File "/var/www/html/celery/vcs_celery/parsing_hub/parsing_hub/wsgi.py", line 15, in <module>
    application = get_wsgi_application()
File "/usr/lib64/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
File "/usr/lib64/python3.5/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "/usr/lib64/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
File "/usr/lib64/python3.5/site-packages/django/conf/__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
File "/usr/lib64/python3.5/site-packages/django/conf/__init__.py", line 106, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib64/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 985, in _gcd_import
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 943, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 985, in _gcd_import
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
ImportError: No module named 'parsing_hub'

I'm new to deploying python applications, any help is most appreciated

EDIT

"""
WSGI config for parsing_hub 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/2.0/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "parsing_hub.settings")

application = get_wsgi_application()

It looks like your Python path for finding packages and modules does not include the necessary directories. From your traceback, you should make sure your project can be imported, by setting the PYTHONPATH environment variable. How to do this, depends on your environment, and whether you're running from a command line, through a webserver or otherwise.

You should set it to (or rather, add to it) the following string (directory name):

/var/www/html/celery/vcs_celery/parsing_hub

or, if that fails, try

/var/www/html/celery/vcs_celery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM