我正在尝试将Django应用程序推送到Heroku。我在尝试推送至heroku 时出现以下错误
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/python
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote: -----> Installing python-3.7.10
remote: -----> Installing pip 20.2.4, setuptools 47.1.1 and wheel 0.36.2
remote: -----> Installing dependencies with Pipenv 2020.11.15
remote: Installing dependencies from Pipfile.lock (a6086c)...
remote: -----> Installing SQLite3
remote: -----> $ python manage.py collectstatic --noinput
remote: Traceback (most recent call last):
remote: File "manage.py", line 22, in <module>
remote: main()
remote: File "manage.py", line 18, in main
remote: execute_from_command_line(sys.argv)
remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/core/management/__init__.py", line 377, in execute
remote: django.setup()
remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
remote: apps.populate(settings.INSTALLED_APPS)
remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
remote: app_config = AppConfig.create(entry)
remote: File "/app/.heroku/python/lib/python3.7/site-packages/django/apps/config.py", line 90, in create
remote: module = import_module(entry)
remote: File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
remote: return _bootstrap._gcd_import(name[level:], package, level)
remote: File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
remote: File "<frozen importlib._bootstrap>", line 983, in _find_and_load
remote: File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
remote: ModuleNotFoundError: No module named 'allauth'
remote:
remote: ! Error while running '$ python manage.py collectstatic --noinput'.
remote: See traceback above for details.
remote:
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/articles/django-assets
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected.
remote:
我的requirements.txt清楚地包含模块django-allauth。我甚至尝试更改版本号,以确保它与糟糕的构建无关
Django==3.1.7
django-agora==0.4
django-allauth==0.43.0
geocoder==1.38.1
geoip2==2.9.0
gunicorn==20.1.0
multidict==5.1.0
psycopg2==2.8.6
psycopg2-binary==2.8.6
requests==2.25.1
requests-oauthlib==1.3.0
urllib3==1.26.3
whitenoise==5.2.0
我能够在本地主机上完美地运行该应用程序。只有当我尝试在heroku上上传时,它才会给我这个错误。
我的设置.py包含作为已安装应用程序的所有身份验证
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
# social login
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
# custom apps
'main',
'video'
]
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/python
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote: -----> Installing python-3.7.10
remote: -----> Installing pip 20.2.4, setuptools 47.1.1 and wheel 0.36.2
remote: -----> Installing dependencies with Pipenv 2020.11.15
remote: Installing dependencies from Pipfile.lock (a6086c)...
Heroku正在使用Pipfile
来安装您的依赖项。调整Pipfile
或将其删除,使其使用requirements.txt
。