尝试将django应用程序部署到heroku时,我不断收到错误消息:[远程拒绝] master-> master(预接收挂钩被拒绝)

时间:2020-04-14 22:57:01

标签: django heroku

下面是构建日志。

Git Repo: https://github.com/omolojakazeem/prosoftmaker.git
Python app detected
 !     Python has released a security update! Please consider upgrading to python-3.8.2
       Learn More: https://devcenter.heroku.com/articles/python-runtimes
cp: cannot create regular file '/app/tmp/cache/.heroku/requirements.txt': No such file or directory
-----> Installing python-3.8.1
-----> Installing pip
-----> Installing SQLite3
Sqlite3 successfully installed.
-----> Installing requirements with pip
       Collecting asgiref==3.2.7
         Downloading asgiref-3.2.7-py2.py3-none-any.whl (19 kB)
       Collecting certifi==2020.4.5.1
         Downloading certifi-2020.4.5.1-py2.py3-none-any.whl (157 kB)
       Collecting dj-database-url==0.5.0
         Downloading dj_database_url-0.5.0-py2.py3-none-any.whl (5.5 kB)
       Collecting Django==3.0.5
         Downloading Django-3.0.5-py3-none-any.whl (7.5 MB)
       Collecting django-crispy-forms==1.9.0
         Downloading django_crispy_forms-1.9.0-py2.py3-none-any.whl (107 kB)
       Collecting django-phone-field==1.8.0
         Downloading django_phone_field-1.8.0-py3-none-any.whl (7.4 kB)
       Collecting django-taggit==1.2.0
         Downloading django_taggit-1.2.0-py3-none-any.whl (45 kB)
       Collecting gunicorn==20.0.4
         Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
       Collecting Pillow==7.1.1
         Downloading Pillow-7.1.1-cp38-cp38-manylinux1_x86_64.whl (2.1 MB)
       Collecting psycopg2==2.8.5
         Downloading psycopg2-2.8.5.tar.gz (380 kB)
       Collecting pytz==2019.3
         Downloading pytz-2019.3-py2.py3-none-any.whl (509 kB)
       Collecting sqlparse==0.3.1
         Downloading sqlparse-0.3.1-py2.py3-none-any.whl (40 kB)
       Collecting whitenoise==5.0.1
         Downloading whitenoise-5.0.1-py2.py3-none-any.whl (20 kB)
       Collecting wincertstore==0.2
         Downloading wincertstore-0.2-py2.py3-none-any.whl (8.8 kB)
       Building wheels for collected packages: psycopg2
         Building wheel for psycopg2 (setup.py): started
         Building wheel for psycopg2 (setup.py): finished with status 'done'
         Created wheel for psycopg2: filename=psycopg2-2.8.5-cp38-cp38-linux_x86_64.whl size=483304 sha256=bdfbf0467dc64bcd7dc084244fa49a1acb6058ac992b962770b9c470ece03bd6
         Stored in directory: /tmp/pip-ephem-wheel-cache-my833lsg/wheels/35/64/21/9c9e2c1bb9cd6bca3c1b97b955615e37fd309f8e8b0b9fdf1a
       Successfully built psycopg2
       Installing collected packages: asgiref, certifi, dj-database-url, sqlparse, pytz, Django, django-crispy-forms, django-phone-field, django-taggit, gunicorn, Pillow, psycopg2, whitenoise, wincertstore
       Successfully installed Django-3.0.5 Pillow-7.1.1 asgiref-3.2.7 certifi-2020.4.5.1 dj-database-url-0.5.0 django-crispy-forms-1.9.0 django-phone-field-1.8.0 django-taggit-1.2.0 gunicorn-20.0.4 psycopg2-2.8.5 pytz-2019.3 sqlparse-0.3.1 whitenoise-5.0.1 wincertstore-0.2
-----> $ python manage.py collectstatic --noinput
       Traceback (most recent call last):
         File "manage.py", line 21, in <module>
           main()
         File "manage.py", line 17, in main
           execute_from_command_line(sys.argv)
         File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
           utility.execute()
         File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
           self.fetch_command(subcommand).run_from_argv(self.argv)
         File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 328, in run_from_argv
           self.execute(*args, **cmd_options)
         File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 369, in execute
           output = self.handle(*args, **options)
         File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 187, in handle
           collected = self.collect()
         File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 113, in collect
           handler(path, prefixed_path, storage)
         File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 338, in copy_file
           if not self.delete_file(path, prefixed_path, source_storage):
         File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 248, in delete_file
           if self.storage.exists(prefixed_path):
         File "/app/.heroku/python/lib/python3.8/site-packages/django/core/files/storage.py", line 311, in exists
           return os.path.exists(self.path(name))
         File "/app/.heroku/python/lib/python3.8/site-packages/django/contrib/staticfiles/storage.py", line 43, in path
           raise ImproperlyConfigured("You're using the staticfiles app "
       django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
 !     Error while running '$ python manage.py collectstatic --noinput'.
       See traceback above for details.
       You may need to update application code to resolve this error.
       Or, you can disable collectstatic for this application:
          $ heroku config:set DISABLE_COLLECTSTATIC=1
       https://devcenter.heroku.com/articles/django-assets
 !     Push rejected, failed to compile Python app.
 !     Push failed

1 个答案:

答案 0 :(得分:0)

我认为您需要:

settings.py

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

,然后在项目根目录中创建目录“ staticfiles”。您必须在其中放入一些文件才能将其上传到git(不能将空目录上传到git)。