Skip to content

Commit

Permalink
migrate jormun to flask cli in place of flask-script
Browse files Browse the repository at this point in the history
  • Loading branch information
kinnou02 committed Jul 23, 2019
1 parent 823e34a commit cd8c7c1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gatling/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You need to create a *uwsgi_config_file.ini* to run with Jormungandr app.
[uwsgi]
plugins = python
http-socket = :5000
wsgi-file = manage.py
wsgi-file = jormungandr:app
callable = app
processes = 4
lazy-apps = True
Expand Down
2 changes: 1 addition & 1 deletion install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Testing

#. Give him the configuration file (by default it uses source/jormungandr/default_settings.py) and run it

``JORMUNGANDR_CONFIG_FILE=your_config.py python manage.py runserver``
``JORMUNGANDR_CONFIG_FILE=your_config.py FLASK_APP=jormungandr:app flask run``

#. Grab a browser and open http://localhost:5000/v1/coverage/default_region

Expand Down
4 changes: 3 additions & 1 deletion scripts/build_navitia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ sed "s,^INSTANCES_DIR.*,INSTANCES_DIR = '$run_dir/jormungandr'," "$navitia_dir"/
#we also don't want to depend on the jormungandr database for this test
sed -i 's/DISABLE_DATABASE.*/DISABLE_DATABASE=False/' "$run_dir"/jormungandr_settings.py

JORMUNGANDR_CONFIG_FILE="$run_dir"/jormungandr_settings.py PYTHONPATH="$navitia_dir/source/navitiacommon:$navitia_dir/source/jormungandr" python "$navitia_dir"/source/jormungandr/jormungandr/manage.py runserver -d -r &
pushd "$navitia_dir/source/jormungandr"
JORMUNGANDR_CONFIG_FILE="$run_dir"/jormungandr_settings.py PYTHONPATH="$navitia_dir/source/navitiacommon:$navitia_dir/source/jormungandr" FLASK_APP=jormungandr:app flask run &
popd

jormun_pid=$!

Expand Down
7 changes: 6 additions & 1 deletion scripts/build_setup_and_run_navitia_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,12 @@ sed "s,^INSTANCES_DIR.*,INSTANCES_DIR = '$run_dir/jormungandr'," "$navitia_dir"/
#we also don't want to depend on the jormungandr database for this test
sed -i 's/DISABLE_DATABASE.*/DISABLE_DATABASE=False/' "$run_dir"/jormungandr/jormungandr_settings.py

JORMUNGANDR_CONFIG_FILE="$run_dir"/jormungandr/jormungandr_settings.py PYTHONPATH="$navitia_dir/source/navitiacommon:$navitia_dir/source/jormungandr" python "$navitia_dir"/source/jormungandr/jormungandr/manage.py runserver -d -r &
export JORMUNGANDR_CONFIG_FILE="$run_dir"/jormungandr/jormungandr_settings.py
export PYTHONPATH="$navitia_dir/source/navitiacommon:$navitia_dir/source/jormungandr"
export FLASK_APP=jormungandr:app
pushd "$navitia_dir/source/jormungandr"
flask run &
popd
jormun_pid=$!


Expand Down
8 changes: 4 additions & 4 deletions source/jormungandr/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Environment variables can be set when the service is started. Referer to [defaul
example for a development environment:

```sh
PYTHONPATH=..:../../navitiacommon/ JORMUNGANDR_INSTANCES_DIR=~/jormung_conf/ JORMUNGANDR_START_MONITORING_THREAD=False JORMUNGANDR_DISABLE_DATABASE=True JORMUNGANDR_IS_PUBLIC=True python manage.py runserver
PYTHONPATH=..:../../navitiacommon/ JORMUNGANDR_INSTANCES_DIR=~/jormung_conf/ JORMUNGANDR_START_MONITORING_THREAD=False JORMUNGANDR_DISABLE_DATABASE=True JORMUNGANDR_IS_PUBLIC=True FLASK_APP=jormungandr:app flask run
```

## custom_settings.py
Expand All @@ -60,7 +60,7 @@ This helps you overwrite the default settings from a file. Prevent from mixing b
Use `JORMUNGANDR_CONFIG_FILE` to tell where your file is located like:

```sh
PYTHONPATH=..:../../navitiacommon/ JORMUNGANDR_INSTANCES_DIR=~/jormung_conf/ JORMUNGANDR_CONFIG_FILE=~/jormung_conf/jormung_settings.py python manage.py runserver
PYTHONPATH=..:../../navitiacommon/ JORMUNGANDR_INSTANCES_DIR=~/jormung_conf/ JORMUNGANDR_CONFIG_FILE=~/jormung_conf/jormung_settings.py FLASK_APP=jormungandr:app flask run
```

# Run
Expand All @@ -69,14 +69,14 @@ To run the web service, you'll need to:

* set `JORMUNGANDR_INSTANCES_DIR` to point at the directory that contains your `jormungandr.json`.
* add `navitia/source/jormungandr` and `navitia/navitiacommon` to your python path via `PYTHONPATH`.
* [optionaly] set `JORMUNGANDR_CONFIG_FILE` to point at your `custom_settings.py`.
* [optionaly] set `JORMUNGANDR_CONFIG_FILE` to point at your `custom_settings.py`.

## Example

From `navitia/source/jormungandr/jormungandr` run :

```sh
PYTHONPATH=..:../../navitiacommon/ JORMUNGANDR_INSTANCES_DIR=~/jormung_conf/ python manage.py runserver
PYTHONPATH=..:../../navitiacommon/ JORMUNGANDR_INSTANCES_DIR=~/jormung_conf/ FLASK_APP=jormungandr:app flask run
```

# Option
Expand Down
1 change: 0 additions & 1 deletion source/jormungandr/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Flask==1.1.1
git+https://github.com/CanalTP/flask-restful.git@76346f65ca12a8edb9b32688cdc192ad391fa686
Flask-SQLAlchemy==2.4
Flask-Script==0.6.7
Flask-Cors==1.9.0
GeoAlchemy2==0.2.4
geojson==1.3.3
Expand Down

0 comments on commit cd8c7c1

Please sign in to comment.