Miscellaneous notes about deploying the django app on Heroku

Most of the following reference URLs are plagiarized. A memorandum for myself when I first touched heroku before.

Reference URL: http://momoto.github.io/blog/2013/08/16/deploying-django-1-dot-5-2-on-heroku/

Install django-toolbelt

I suddenly stumble here.

(venv) $ pip install django-toolbelt

Error: pg_config executable not found.

What is pg_config? When I looked it up, it seems to be a file that contains the version information of the installed PostgreSQL. reference:

So, install PostgreSQL with homebrew. Reference: http://qiita.com/youcune/items/5b783f7fde45d0fd4b35

$ brew install postgresql

This is a safe breakthrough.

Create a Django project

What is pip freeze?

(venv) $ pip freeze > requirements.txt

Reference URL: http://tdoc.info/blog/2014/01/15/pip.html> freeze can be written to a file as standard output and can be used later for install or bundle.

And that.

Expand to Heroku

I did the procedure and git push heroku master, but I get an application error. スクリーンショット 2014-03-09 13.51.26.png

Check the log.

(venv)$heroku logs
...
2014-03-09T00:36:57.628732+00:00 app[web.1]: ImportError: No module named side_dish.wsgi

Yup. It seems that side_dish.wsgi is missing ... It may have been wrong at the environment construction stage.

That's why I started over from the beginning. Next time, I will try it while looking at the official document. Official documentation: https://devcenter.heroku.com/articles/getting-started-with-django

Then, such a note.

Don't forget the . at the end. This tells Django to put the extract the into the current directory, instead of putting it in a new subdirectory.

(venv)$ django-admin.py startproject hellodjango .

I didn't put it on. スクリーンショット 2014-03-09 16.49.40.png

This completes the confirmation that it is working for the time being. After all, you should read the official document without getting tired of English.

Play around with it

After doing the above for a while, heroku's command stopped working.

(venv)$ heroku ps
 !    No app specified.
 !    Run this command from an app folder or specify which app to use with --app APP.

It seems that you should specify the name of APP and execute it.

(venv)$ heroku open --app radiant-depths-6246
Opening radiant-depths-6246... done

I want to change the APP name

Reference URL: https://devcenter.heroku.com/articles/renaming-apps#manually_updating_a_git_remote

$ heroku apps:rename newname

With this, APP will be renamed, but CheckOut will run automatically. The following command does not check out.

$ heroku apps:rename newname --app oldname

Change the remote URL used by git with the following command.

$ git remote rm heroku
$ heroku git:remote -a newname

About checking the operation of the code

You may want to experiment with the console on heroku, but don't leave it connected to heroku all the time with `` `$ heroku run console```. During that time, it will be converted into usage time, so be careful as it may exceed the free usage time allowance (750 hours). Reference URL: http://blog.mah-lab.com/2013/05/16/heroku-commons-16/

About DB settings in the local environment

I want to use sqlite in the local environment (development environment). If you identify from the environment variables, you can switch the DB between heroku and the local environment.

$ export LOCAL_ENV=LOCAL_ENV

Reconfigure the DB environment by referring to the settings.py of the reference URL. If the environment variable added earlier exists, it is determined as the local environment and the database is set to sqlite3.

Reference URL: http://source.hatenadiary.jp/entry/2013/02/05/173636

Recommended Posts

Miscellaneous notes about deploying the django app on Heroku
Miscellaneous notes about the Django REST framework
Deploy the Django app on Heroku [Part 1]
Deploy the Flask app on Heroku
Deploy the Flask app on heroku
A story about deploying a Twitter-linked app created using Flask + gunicorn on Heroku
Celery notes on Django
Memo of deploying Django × Postgresql on Docker to Heroku
[Django] Notes on using django-debug-toolbar
Deploy masonite app on Heroku 2020
Django --Overview the tutorial app on Qiita and add features (2)
Run the app with Flask + Heroku
Deploy your Django application on Heroku
python + django + scikit-learn + mecab (1) on heroku
Implement a Django app on Hy
Detect app releases on the App Store
Try Ajax on the Django page
python + django + scikit-learn + mecab (2) on heroku
Publish DJango page on heroku: Practice
How to deploy a Django app on heroku in just 5 minutes
[First personal development] The story of deploying the Flask app and Twitter's automatic reply bot on Heroku
Django blog on heroku: login implementation
Notes on using matplotlib on the server
Notes on installing Ubuntu 18.04 on the XPS 15 7590
Heroku deployment of the first Django app that beginners are addicted to
Deploy Django api on heroku (personal note)
Notes on creating static files in Django
[Django] Error encountered when deploying heroku Part 2
Notes on using OpenCL on Linux on the RX6800
Change the order of PostgreSQL on Heroku
Getting Started with Heroku, Deploying Flask App
A story about a 503 error on Heroku open
django notes
Django notes
Publish django project developed in Cloud9 on heroku
What I found by deploying Django on EC2
Exclusive release of the django app using ngrok
A story about running Python on PHP on Heroku
Think about the selective interface on the command line
I want to upload a Django app to heroku
When I deployed the Django app to Heroku, I got Module Not Found: <project-name> .wsgi.