0

I created an application using Django 3.1.5 and for some reason, it does not deploy correctly. I will share what I did and have it.

I have set up my Procfile and I have my requirements.txt, I did the deployment as I told on the website, but I am still getting an error.

computer setting image and Procfile

On my settings.py I have this:

# on the top of the file
import django_heroku

# on the bottom of the file
STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_DIRS = [
    os.path.join(BASE_DIR, 'todo/static')
]

LOGIN_URL = '/login'

# Activate Django-Heroku.
django_heroku.settings(locals())

Procfile

web: gunicorn todowoo.wsgi

After I finish the deployment I get this error

Application error An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. heroku logs --tail for details

Here are the details:

2021-01-27T03:16:07.704192+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=djangotodowoo.herokuapp.com request_id=babd8359-3dfe-4df9-8ce6-5243de91b159 fwd="66.31.116.154" dyno= 
connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:07.912002+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=djangotodowoo.herokuapp.com request_id=4114d73f-f15f-4d35-9c1b-e25225a36bde fwd="66.31.116.154" dyno= connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:10.630599+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=djangotodowoo.herokuapp.com request_id=9426a4a1-061f-41b6-a9a0-46190b752b60 fwd="66.31.116.154" dyno= 
connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:10.760576+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=djangotodowoo.herokuapp.com request_id=cb4c8412-eaa2-482a-9daa-e5126f2a89e3 fwd="66.31.116.154" dyno= connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:11.398016+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=djangotodowoo.herokuapp.com request_id=8f025699-e7b8-4ca8-9795-36ad7754ef9f fwd="66.31.116.154" dyno= 
connect= service= status=503 bytes= protocol=https
2021-01-27T03:16:11.548669+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=djangotodowoo.herokuapp.com request_id=d1c4ed4e-bbf6-43ff-88d0-2788f268fbe3 fwd="66.31.116.154" dyno= connect= service= status=503 bytes= protocol=https
2021-01-27T03:18:44.000000+00:00 app[api]: Build started by user lenilunderman@gmail.com
2021-01-27T03:19:12.176886+00:00 app[api]: Release v6 created by user lenilunderman@gmail.com
2021-01-27T03:19:12.176886+00:00 app[api]: Deploy 6caa0271 by user lenilunderman@gmail.com
2021-01-27T03:19:22.000000+00:00 app[api]: Build succeeded

I tried to run heroku ps:scale web=1 and I got this:

Scaling dynos... !
 !    Couldn't find that process type (web).

Any idea how to solve this? Thank you.

1 Answers1

1

I have encountered a similar situation very recently. I followed these commands to successfully deploy django app into heroku

  • First make sure you have requirements.txt and Procfile

  • In Procfile, the contents were like this

  • web: python manage.py runserver 0.0.0.0:$PORT

  • And run python manage.py collectstatic just to make sure no errors from collectstatic

  • Then these commands in cmd

  • heroku login

  • Then login from browser

  • git init

  • heroku git:remote -a app_name

  • git add .

  • git commit -am "first commit"

  • git push heroku main

  • heroku run python manage.py migrate

  • heroku open

SAI SANTOSH CHIRAG
  • 2,046
  • 1
  • 10
  • 26
  • https://github.com/heroku/python-getting-started. Once do as seen in this link from the start – SAI SANTOSH CHIRAG Jan 27 '21 at 04:32
  • thank you very much! I was able to deploy. I followed your instructions and it worked. My main problem was the location of the Procfile, instead of root, I added it to the project itself. After I move it to the correct location, everything went smooth. – leni lunderman Jan 27 '21 at 04:49
  • Ok. I should have mentioned the location of `Procfile` – SAI SANTOSH CHIRAG Jan 27 '21 at 04:50
  • I noticed that the admin for my django works locally but not remotely. Do I have to create a new admin locally and push the code again? I am able to create users online, but the admin does not exist at the current moment. any idea what may be? – leni lunderman Jan 27 '21 at 04:56
  • Use /admin and enter the username and password if you have created superuser already – SAI SANTOSH CHIRAG Jan 27 '21 at 05:15
  • I have created the superuser with ``` python manage.py createsuperuser ``` I even push the code again to deployment in case I need to update something. I am able to create an account and login to accounts but I am not able to login with the superuser. I tried: https://djangotodowoo.herokuapp.com/admin but redirects me to: https://djangotodowoo.herokuapp.com/admin/login/?next=/admin/ I am still able to see the login page. I am not sure if that's because I have a setting on my settings.py to do that or is it something else. settings.py LOGIN_URL = '/login' – leni lunderman Jan 27 '21 at 05:22
  • Try logging in with any credentials in the admin login page – SAI SANTOSH CHIRAG Jan 27 '21 at 05:24
  • 1
    I was able to fix the issue, I just need to create a new superuser on heroku. `heroku run python manage.py createsuperuser` – leni lunderman Jan 27 '21 at 16:07