pythonanywhere wsgi模块未找到错误

时间:2018-10-21 21:05:30

标签: pythonanywhere

我正在尝试在pythonanywhere托管服务上托管django网站,但我收到以下错误消息:

2018-10-21 20:56:14,359: Error running WSGI application
2018-10-21 20:56:14,365: ModuleNotFoundError: No module named 'energiasc'
2018-10-21 20:56:14,365:   File "/var/www/adrielw_pythonanywhere_com_wsgi.py", line 24, in <module>
2018-10-21 20:56:14,365:     application = get_wsgi_application()
2018-10-21 20:56:14,365: 
2018-10-21 20:56:14,365:   File "/home/adrielw/.virtualenvs/my_env_django/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2018-10-21 20:56:14,366:     django.setup(set_prefix=False)
2018-10-21 20:56:14,366: 
2018-10-21 20:56:14,366:   File "/home/adrielw/.virtualenvs/my_env_django/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
2018-10-21 20:56:14,366:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2018-10-21 20:56:14,366: 
2018-10-21 20:56:14,366:   File "/home/adrielw/.virtualenvs/my_env_django/lib/python3.6/site-packages/django/conf/__init__.py", line 57, in __getattr__
2018-10-21 20:56:14,366:     self._setup(name)
2018-10-21 20:56:14,367: 
2018-10-21 20:56:14,367:   File "/home/adrielw/.virtualenvs/my_env_django/lib/python3.6/site-packages/django/conf/__init__.py", line 44, in _setup
2018-10-21 20:56:14,367:     self._wrapped = Settings(settings_module)
2018-10-21 20:56:14,367: 
2018-10-21 20:56:14,367:   File "/home/adrielw/.virtualenvs/my_env_django/lib/python3.6/site-packages/django/conf/__init__.py", line 107, in __init__
2018-10-21 20:56:14,368:     mod = importlib.import_module(self.SETTINGS_MODULE)
2018-10-21 20:56:14,368: ***************************************************
2018-10-21 20:56:14,368: If you're seeing an import error and don't know why,
2018-10-21 20:56:14,368: we have a dedicated help page to help you debug: 
2018-10-21 20:56:14,368: https://help.pythonanywhere.com/pages/DebuggingImportError/

我的settings.py文件如下所示>>>

import os
import sys

# add your project directory to the sys.path
project_home = '/home/adrielw/energsc/energiasc'
if project_home not in sys.path:
    sys.path.insert(0, project_home)



# set environment variable to tell django where your settings.py is
os.environ['DJANGO_SETTINGS_MODULE'] = 'energiasc.settings'


# serve django via WSGI
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

我的文件结构是这样>>>

first level

next level of file directory structure

我很困惑!有什么想法吗?

但是这篇文章中也存在类似的问题,但这并没有帮助我(Error running WSGI application , ModuleNotFoundError: No module named 'mysite')!!

1 个答案:

答案 0 :(得分:1)

应该是

 <mat-autocomplete #auto="matAutocomplete" (optionSelected)="optionSelected($event, row, column, rowIndex)">
      <mat-option *ngFor="let option of filteredOptions | async" [value]="option">
        {{option}}
      </mat-option>
    </mat-autocomplete>

<input matInput placeholder="Amount" [(ngModel)]="amount">

使用您当前的代码尝试在以下位置找到设置文件

  optionSelected(event){
    if(event.option.value == 'Physics')
      this.amount = 2000;
    if(event.option.value == 'Maths')
      this.amount = 5000;
    if (event.option.value == 'Biology')
      this.amount = 10000;
  }