Hi I have successfully deployed the python django app to heroku with no errors. However when i go to the link it just does not show anything.
heroku logs show me there's some H14 error.
Procfile.txt had been added with web: python manage.py runserver 0.0.0.0:6000
Why is the page still not showing up and it shows that no dynos are active.
URL: https://guarded-castle-63814.herokuapp.com/
The runserver is used for develop, on production use gunicorn.
Procfile
web: gunicorn config.wsgi
Related
I have Django apps, which include users and posts models. The apps work perfectly at local following making migrations and migrating. I tried two different ways to deploy the apps to Heroku. First, using Heroku Git, the apps works on Heroku the same as at local.
When using GitHub, however, all data were not brought to Heroku. I tried to run "python manage.py makemigrations" and "python manage.py migrate" on Heroku, but the data from local was not brought still.
I would really appreciate it if you could please explain and help with the issue using GitHub.
I think you have to migrate on Heroku as well, try:
heroku run python manage.py migrate
See the heroku docs
check your .gitignore file maybe db.sqlite in gitignore file and you can remove it
another option is dumpdata and load in production
you can run
python3 manage.py dumpdata > data.json
and load data in production
python3 manage.py loaddata data.json
I have previously ran this app on Heroku without issues. But it had been around 6 months since I deployed and I also switched computers from a Linux to a Windows machine.
Now when I deploy, the deployment is successful but the service does not work. When I check the logs the error is:
code=H14 desc="No web processes running"
I have not changed the Procfile or the requirements.txt since it had been working
requirements.txt:
django
gunicorn
django-heroku
requests
djangorestframework
django-cors-headers
flask-sslify
Procfile:
release: python manage.py migrate
web: gunicorn findtheirgifts.wsgi --log-file -
wsgi.py
"""
WSGI config for findtheirgifts project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "findtheirgifts.settings")
application = get_wsgi_application()
I have tried some suggestions from similar threads
heroku ps:restart
heroku buildpacks:clear
heroku ps:scale web=1
None of which seemed to change anything. Any help on this would be greatly appreciated!
As the error indicates, your app doesn't have any web process running.
You can see all running processes from the CLI with the following command:
heroku ps -a <your app name>
And scale your web process to 1 with the following:
heroku ps:scale web=1 -a <your app name>
Which will start one instance of your app.
See the Heroku Scaling Documentation.
Turns out in initialized the heroku git file in a different directory than I had previously. Causing the app to not find the Procfile.
I am installing an add-on named New Relic (monitoring) on my Django Heroku app, following this doc.
After installaling the new relic agent, I was asked to change the Procfile to:
web: newrelic-admin run-program python manage.py run_gunicorn -b "0.0.0.0:$PORT" -w 3
I dit it.
When starting the app on Heroku, I can see in heroku logs that it's crashed because of a Unknown command: 'run_gunicorn' error.
Indeed, typing heroku run python manage.py help let me see that the command does not exist.
What's going on?
here is an extract of heroku run pip freeze:
Django==1.7.6
gunicorn==19.1.1
newrelic==2.46.0.37
I just deployed Askbot forum to heroku successfully, but sometimes when running 'git push heroku master', the automatic collectstatic process fails (to me it looks like a random failure), prompting:
-----> Python app detected
-----> Installing dependencies with pip
Cleaning up...
-----> Preparing static assets
Collectstatic configuration error. To debug, run:
$ heroku run python ./askbot/setup_templates/manage.py collectstatic --noinput`
Well I don't really know if that's the problem, but the manage.py in .askbot/setup_templates/ contains the app's native version of the file, not the one I'm using for deployment, which is located in the app's root.
How could I make git push heroku master use the right manage.py file?
Change the path in your Procfile. Typically its something like this:
web: gunicorn hellodjango.wsgi --log-file -
Adjust it:
# from:
web: gunicorn .askbot/setup_templates/yourApp.wsgi
# to:
web: gunicorn .askbot/yourApp.wsgi
to check if the path was indeed your problem run this from the terminal:
heroku run python ./manage.py collectstatic
# or
heroku run python ./yourApp.wsgi collectstatic
Deleting or renaming Manage.py in askbot/setup_templates/ solved the problem.
Git Push Heroku Master never fails whan running collectstatic ever after.
so I believe that for some reason, probably because of sys.path configuration sometimes
Git Push Heroku Master first discovered and used ./askbot/setup_templates/manage.py instead of ./manage.py (which was the right one), and encountered an ImportError.
This is a spin off question from gunicorn on heroku: binding to localhost.
How can I get gunicorn to work both locally (using foreman) and for deployment on Heroku?
Procfile contains:
web: gunicorn mysite.wsgi
When I deploy locally using foreman, gunicorn binds to http://0.0.0.0:5000. I want it to bind to 127.0.0.1:8000. However, if I change to the Procfile to this:
web: gunicorn -b 127.0.0.1:8000 mysite.wsgi
Then I can't deploy to Heroku, the browser will return "application error"
$ heroku ps
=== web (1X): `gunicorn -b 127.0.0.1:8000 mysite.wsgi`
web.1: crashed 2013/08/22 23:45:04 (~ 1m ago)
Where is the default binding address set and/or what gunicorn options do I put in Procfile to get it to work on 127.0.0.1?
What could be unique to my situation that causes a deviant default setup (I'm working in mac OS - lion, maybe?)
Dont bind gunicorn to the local ip with. web: gunicorn -b 127.0.0.1:8000 mysite.wsgi in your procfile. This forces your django app to always use this local port whether or not its deployed locally or on Heroku's servers.
Using
web: gunicorn mysite.wsgi
in your procfile will make your application deploy at 127.0.0.1:8000 locally and 0.0.0.0:5000 on heroku's severs. I know you had to use the bind method in your previous question to get heroku to work locally, but that method is only covering an issue that isn't resolved.
Using foreman start with web: gunicorn mysite.wsgi should work, as told by the official docs (and my own experince :)).
Try just web: gunicorn mysite.wsgi in your procfile, deploy it to heroku and see if it works.
https://devcenter.heroku.com/articles/python