Развертывание Django на PythonAnywhere
Недавно я хотел развернуть один из моих веб-приложений на PythonAnywhere, но возникла некоторая проблема.
If I deploy the webapp in a virtualenv. I would not be able to install some critical packages within the virtualenv (especially Pandas). The console will show disk quota exceeded.
Now I am trying to deploy the webapp in base environment(I left the Virtualenv part in PythonAnywhere Web tab blank), but the page shows error and after checking log, it says modulenotfound error. But I am sure the module is installed within that environment. BTW, both environment are run under Python 3.8
Ошибка страницы ModuleNotFoundError
Моя проблема заключается в следующем:
Can anyone tell how to either reduce storage space required to install certain huge package like pandas or how do I clean out more space (or any other workable solutions)
Can I deploy webapp under base environment? If yes, what is the root cause of the error shown above and solution to it. Here I provide some configuration of my webapp.
Часть кода на вкладке Web:
Исходный код:/home/myusername/my_project_folder
Рабочая директория:/home/myusername/
Файл конфигурации WSGI:/var/www/username_pythonanywhere_com_wsgi.pyФайл конфигурацииWSGI(/var/www/username_pythonanywhere_com_wsgi.py):
import os
import sys
path = '/home/myusername/my_project_folder'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'my_project.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
- Некоторая часть в settings.py
ALLOWED_HOSTS = ['myusername.pythonanywhere.com']
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'home.apps.HomeConfig',
'django_plotly_dash.apps.DjangoPlotlyDashConfig',
'channels',
'channels_redis'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_plotly_dash.middleware.BaseMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
]
WSGI_APPLICATION = 'my_project_name.wsgi.application'
- python manage.py migrate migrate
Приложение способно управлять сервером runerver.py, но веб-страница показывает ошибку
Просьба искать решения здесь! Заранее спасибо!