简体   繁体   English

Heroku 推送失败,因为它找不到模块 allauth

[英]Heroku push fails because it can't find module allauth

I am trying to push a Django app to to Heroku.我正在尝试将 Django 应用程序推送到 Heroku。 I get the following error on trying to push to 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:

My requirements.txt clearly contain the module django-allauth.我的 requirements.txt 清楚地包含模块 django-allauth。 I even tried changing the version number to ensure it didn't have something to do with bad build我什至尝试更改版本号以确保它与糟糕的构建无关

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

I am able to run the app on my localhost perfectly.我能够完美地在我的本地主机上运行该应用程序。 It only throws me this error when I try to upload on heroku.当我尝试在 heroku 上上传时,它只会向我抛出这个错误。

My settings.py contain allauth as an installed app我的 settings.py 包含 allauth 作为已安装的应用程序

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 is using Pipfile to install your dependencies. Heroku 正在使用Pipfile安装您的依赖项。 Either adjust your Pipfile or remove it so it uses requirements.txt .调整您的Pipfile或将其删除,以便它使用requirements.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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