Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/comhendrik/pythonherokuservertutorial

Tutorial to set up a heroku webpage
https://github.com/comhendrik/pythonherokuservertutorial

flask heroku python

Last synced: 7 days ago
JSON representation

Tutorial to set up a heroku webpage

Awesome Lists containing this project

README

        

First, make sure you have the Heroku CLI installed in addition to git.

Create a virtual environment in the directory with:

```
python3 -m venv
```

and activate it with
```
. /bin/activate
```

You will use a gunicorn production server and the Flask Framework to build your Python Server. So you need to install all Frameworks with:

```
pip install -r requirements.txt
```

or install them seperately with:

```
pip install
```

You need a Procfile located in the root directory. I already added it to the root directory so you don't need to create it on your own. It contains everything you need to run a gunicorn server on heroku.

Now run:
```
git init
```
The git init command isn't necassary because you already have a repository after downloading but you need to include when you start from scratch
```
git add .
git commit -m ""
```
You are ready for the preperations on your local directory.

We are starting with the deployment on heroku:
Run and follow the instructions:
```
heroku login
```
You need to create a app with:
```
heroku create
```
(if you don't provide appname, heroku creates a random name.)

To give heroku acces to your git repo run:
```
heroku git:remote
```
Now is the time to push your repo to heroku with(heroku will automatically build the application and you can visit it under https://appname.herokuapp.com/test):
```
git push heroku master
```