Skip to content

onlyoneaman/Heroku-app-backend

Repository files navigation

Python: Getting Started

A barebones Django app, which can easily be deployed to Heroku.

This application supports the Getting Started with Python on Heroku article - check it out.

Running Locally

Make sure you have Python 3.7 installed locally. To push to Heroku, you'll need to install the Heroku CLI, as well as Postgres.

Intalling Heroku Cli

$ sudo snap install --classic heroku

The above command is for Ubuntu 16+ Users For other options, visit here

Install Postgres

  1. Check this link for instaling Postgres
$ sudo su - postgres
$ psql
postgres-# CREATE ROLE your_username WITH LOGIN CREATEDB ENCRYPTED PASSWORD 'your_password';
postgres-# \q

TO change a user to superuser

ALTER USER dell WITH SUPERUSER;

Commands to run heroku app locally

$ git clone https://github.com/heroku/python-getting-started.git
$ cd python-getting-started

$ python3 -m venv getting-started
$ pip install -r requirements.txt

$ createdb python_getting_started

$ python manage.py migrate
$ python manage.py collectstatic

$ heroku local

Your app should now be running on localhost:5000.

Deploying to Heroku

$ heroku create
$ git push heroku master

$ heroku run python manage.py migrate
$ heroku open

or

Deploy

Documentation

For more information about using Python on Heroku, see these Dev Center articles: