Skip to content

towards/python-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python example app for Gleis PaaS

This is a Python example app made for the Gleis PaaS built using the Django web framework.

Prerequisites

In order to run this sample app locally you will need Python to be installed on your computer and an account on the Gleis PaaS as well as the Gleis CLI Ruby gem to be able to deploy it.

Try out the sample app locally

Download your own copy of this sample app:

$ git clone git@github.com:towards/python-example.git
$ cd python-example

Install dependencies:

$ pip install -r requirements.txt

Apply pending database migrations:

$ python manage.py migrate

Collect static files into static directory:

$ python manage.py collectstatic

Start app:

$ python manage.py runserver

The sample app should now be reachable locally at http://localhost:8000/

Deploy to Gleis

Create new app on Gleis:

$ gleis app create

Create new PostgreSQL database for app on Gleis:

$ gleis db new

Upload app to Gleis:

$ git push gleis master

Apply pending database migrations:

$ gleis app exec "python manage.py migrate"

The sample app will be online in a few seconds and reachable through the secure URL mentioned when you created the Gleis app with the above command.

Remarks

In this sample app, Django is configured to use:

  • SQLite as default database when run locally
  • PostgreSQL as database when deployed on Gleis
  • DJ-Database-URL to automatically read the DATABASE_URL config var on Gleis to connect to the PostgreSQL database
  • WhiteNoise for serving static files directly from the web server

About

Python example app using Django for the Gleis PaaS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages