Skip to content
wsgi application to be both a standalone gtfs editor or deployed to google app engine/other wsgi compliant hosting.
Branch: develop
Clone or download
Latest commit d9fcd3c Jul 20, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Minor corrections to old editor template Jul 20, 2018
docs Add docs stubs May 18, 2016
migrations Make route.route_short_name a text col Jun 28, 2018
salt refactor salt files for readability Sep 25, 2016
.babelrc Update webpack and ol Aug 31, 2017
.env.docker.example add docker example .env Sep 3, 2017
.env.example update FE, calendar endpoint and add .env file example Feb 8, 2015
.gitignore Update gitignore Jul 20, 2018
.gitmodules remove submodule for FE Dec 20, 2014
Dockerfile
LICENSE finally add a license Mar 9, 2015
Procfile basic procfile Feb 21, 2016
README.md Webpack + angular editor. (#207) Feb 12, 2017
Vagrantfile WIP Aug 19, 2016
app.json add defaults for env vars Feb 12, 2017
config.py route editor form Jul 2, 2018
docker-compose.yml messing around with docker Sep 2, 2017
manage.py fix manage file Aug 12, 2016
nginx.site.example add nginx config example Feb 24, 2015
package-lock.json Update webpack and ol Aug 31, 2017
package.json Update webpack and ol Aug 31, 2017
requirements.txt Add sentry, raven Jun 24, 2018
runtime.txt
webpack.config.js build config Sep 3, 2017
wsgi.py nginx and uwsgi for the win Sep 16, 2015

README.md

Gtfseditor

A customizable editor for GTFS files which can be used both as a standalone app or deployed to a wsgi compliant hosting.

Management

A series of database management scripts are accesible from the command line using the manage.py script.

To initialize the database, use

$ ./manage.py db upgrade

In development mode this will create a file called data-dev.sqlite in the same directory with a DB looking like the one in production.

Configuration

The main configuration file for the server is located at config.py. Environment variables can be overriden by writing them inside a .env file at the root level.

Development

The project has two main parts,

  • a client application, located at app/
  • a API server + some building tools at server/

The client application uses

  • require.js to load javascript modules,
  • backbone.js to structure models and views,
  • openlayers.js to create and manage the map components,
  • bootstrap.js for styling, scaffolding and plugins,
  • handlebars.js as a templating engine.

The API server uses

  • flask.py for WSGI,
  • SQLAlchemy for database abstraction,
  • transitfeed.py for gtfs building and validation.

among other auxiliary packages.

Database

Development and local usage are best served by using SQLite as a db engine. It allows for rapid setup and portability.

Some hosted services do not support sqlite as a db engine (heroku), and postgres can be used.

Install postgresql and run

createdb -T template0 dbname

You are now ready to initialize an empty DB by using

FLASK_CONFIG=dev ./manage.py db upgrade

Importing a DB dump

To create a database dump use

pg_dump -Fc --no-acl --no-owner dbname > mydb.dump

To import a DB dump run

pg_restore -d dbname dump.tar

where dbname is the name of your database.

Deployment to EC2

Set up an ubuntu instance in Amazon EC2. On it, run

$ sudo apt-get update
$ sudo apt-get install python-pip libpq-dev python-dev nginx postgresql postgresql-contrib

Configuring nginx

Create a site file in /etc/nginx/sites-available/ by copying the example file nginx.site.example over and editing it appropriately. Once you are done, enable the site using

$ sudo ln -s \
/etc/nginx/sites-available/mydomain.com \
/etc/nginx/sites-enabled/mydomain.com

where mydomain.com is the name of the file you created.

Configuring Postgresql

Create a database user with the same name as your current username

$ sudo -u postgres createuser --superuser $USER

and change it's password using

$ sudo -u postgres psql
...
postgres=# \password $USER

This user will not need a password to connect to the DB.

You can’t perform that action at this time.