본문 바로가기

Django

[Django] heroku 서버 배포

엄청난 에러들과 함께 6시간만에 서버 배포 성공.. heroku 서버 배포를 처음 해보다보니 어이없는 삽질을 많이 했다.

 

전반적인 과정은 이 링크를 참고하였다. 

https://developer.mozilla.org/ko/docs/Learn/Server-side/Django/Deployment

 

Django 튜토리얼 파트 11: Django 웹사이트 공개하기 - Web 개발 학습하기 | MDN

당신은 이제 놀라운 LocalLibrary 웹사이트를 (테스트도 마치고) 만들었으니, 도서관 스태프나 회원들이 인터넷을 통해 이용할 수 있도록 공개된 웹 서버에 설치하길 원할 것이다. 이번 장에서는

developer.mozilla.org

 

에러메시지

django at=error code=H10 desc="App crashed" method=GET 어쩌구...

Procfile 문제였다.

web: gunicorn deliveryFriend.wsgi --log-file -

wsgi.py가 있는 경로를 살펴 보면 나의 경우 /deliveryFriend/wsgi.py 였는데 저 링크만 보고 따라하다가 deliveryFriend로 안고치고 그대로 복붙해서 에러가 났었다. 저 부분 고치니까 해결.

 

저 부분도 문제가 없다면 아래 링크를 따라해보면 좋을 것 같다. 구글링 하다가 발견했는데 도움 받았다는 사람들이 많았다.

https://dev.to/lawrence_eagles/causes-of-heroku-h10-app-crashed-error-and-how-to-solve-them-3jnl

 

Causes of Heroku H10-App Crashed Error And How To Solve Them

About Heroku H10-App crashed error code, its causes, and how to avoid it.

dev.to

 

에러메시지

Error while running '$ python manage.py collectstatic --noinput'.

heroku config:set DISABLE_COLLECTSTATIC=1 터미널에 치면 해결.

 

https://sweetdev.tistory.com/135

 

[django] Heroku 배포 시 python manage.py collectstatic --noinput' 에러 수정하는법

한참을 고생했는데, https://stackoverflow.com/questions/41515999/python-manage-py-collectstatic-noinput-error-when-deploying-django-project-to python manage.py collectstatic --noinput error when depl..

sweetdev.tistory.com

 

에러메시지

Error: Cannot run more than 1 Free size dynos. » » Error ID: cannot_run_above_limit

이 에러는 heroku createsuperuser 하다가 계정 잘못 만들어서 다시 만들려니까 생겼던 에러

$ heroku run python manage.py createsuperuser
Running python manage.py createsuperuser on ⬢ ★★... done
 »   lt-scaling-limits for more information.
 »   Error: Cannot run more than 1 Free size dynos.
 »
 »   Error ID: cannot_run_above_limit
 »   See https://devcenter.heroku.com/articles/dyno-size#default-scaling-limits for more information.
$ heroku ps
Free dyno hours quota remaining this month: 465h 40m (84%)
Free dyno usage for this app: 0h 0m (0%)
For more information on dyno sleeping and how to upgrade, see:
https://devcenter.heroku.com/articles/dyno-sleeping

=== run: one-off processes (1)
run.6812 (Free): up 2021/03/15 10:41:06 +0900 (~ 33m ago): python manage.py createsuperuser

=== web (Free): gunicorn announcement.wsgi --log-file - (1)
web.1: up 2021/03/15 10:54:09 +0900 (~ 19m ago)

run.6812라고 써있는거를 주목하자. 이거 이용해서 아래처럼 하면 된다.

$ heroku ps:stop run.6812
Stopping run.6812 dyno on ⬢ ★★... done

https://velog.io/@solar3070/Hroku-%EB%B0%B0%ED%8F%AC-%EC%A4%91-%EC%98%A4%EB%A5%98 

 

Heroku 오류 - Cannot run more than 1 Free size dynos

 

velog.io

 

에러메시지

Building wheel for twisted-iocpsupport (pyproject.toml): finished with status 'error' ERROR: Command errored out with exit status 1:

requirements.txt에서 twisted-iocpsupport 를 지워주면 된다.

https://stackoverflow.com/questions/66428469/twisted-iocpsupport-error-when-using-pip-on-ubuntu-debian-io-h-missing

 

twisted-iocpsupport error when using pip on ubuntu / debian io.h missing

Receiving error: Building wheel for twisted-iocpsupport (PEP 517): started ERROR: Command errored out with exit status 1: command: /usr/bin/python3 /tmp/tmpv8s6qz76 build_wheel /tmp/tmp9l8hgc...

stackoverflow.com

 

에러메시지

Requested runtime (python-3.6.4) is not available for this stack (heroku-20).

아래 링크 참고해서 runtime.txt의 파이썬 버전을 수정해준다. Heroku가 지원하는 Python 실행버전이 정해져 있다. 파이썬 3.6.4는 현재 지원을 안해서 python-3.9.10 으로 변경했더니 해결되었다.

https://devcenter.heroku.com/articles/python-support

 

Heroku Python Support | Heroku Dev Center

Last updated February 02, 2022 Heroku supports all popular web frameworks for Python (Django, Flask, Pyramid, and so on). For a deployment tutorial that uses a sample Django app, see Getting Started on Heroku with Python. Recognizing a Python app Heroku au

devcenter.heroku.com

 

헤맸던 에러들은 대충 이정도인 것 같고 + 온갖 깃허브 에러들도 골치 아팠다..

그래도 성공!! 

'Django' 카테고리의 다른 글

[Django] Sqlite를 heroku Postgresql로 변환하기  (0) 2022.03.29
[BlogApp] 태그 기능 개발  (0) 2022.01.24
[BlogApp] views.py 작성  (1) 2022.01.24
[BlogApp] URLconf 2계층으로 코딩하기  (2) 2022.01.24
[BlogApp] admin.py 작성  (0) 2022.01.23