Files
pygeoapi/docs/source/install.rst
T
Jorge Samuel Mendes de Jesus da267e9ed3 Issue 43 (#207)
* squach contents new branch

* source code explanations

* flake8

* change in requirements

* 	modified:   docs/source/code.rst
	modified:   docs/source/plugins.rst

* 	modified:   docs/source/code.rst
	modified:   pygeoapi/formatter/csv_.py
	modified:   pygeoapi/provider/geojson.py

* changes requred in review code

* 	modified:   .travis.yml
missing "

* change file to use requirements-dev.txt
	modified:   readthedocs.yml

* flask_cors removal from requirements.txt

* text changes
2019-08-14 15:14:13 -04:00

55 lines
2.0 KiB
ReStructuredText

.. _install:
Install
=======
pygeoapi is nativally run as a Flask app (the code struct is an API and Flask is used as a wrapper).
pygeoapi uses two configuration files: **pygeoapi-config.yml** and **openapi.yml**. First configuration contains all the information and setup to run pygeoapi while the second is exclusivally for the openapi.
pygeoapi requires setting ``PYGEOAPI_CONFIG`` and ``PYGEOAPI_OPENAPI`` env variable. ``PYGEOAPI_CONFIG`` points to the yaml file containing the configuration, in the example
bellow we copy the ``local.config.yml`` default configuration to ``pygeoapi-config.yml`` and use this configuration file.
``PYGEOAPI_OPENAPI`` variable is the path to openapi file configuration, this file **needs to be autogenerated** using the ``pygeoapi generate-openapi-document`` command and
the pygeoapi config files e.g: ``pygeoapi generate-openapi-document -c local.config.yml > openapi.yml``. And then setting the env variable to the path:
``export PYGEOAPI_OPENAPI=/path/to/openapi.yml``
For production environments it is recommended to use :ref:`docker` or a specialized WSGI HTTP server :ref:`wsgi`
Copy/paste install
------------------
It is advisable to run pygeoapi inside an isolated enviroment either *virtualenv* or *docker*, mainly to avoid python package conflicts.
.. code-block:: console
#create virtualenv
virtualenv -p python pygeoapi
cd pygeoapi
. bin/activate
git clone https://github.com/geopython/pygeoapi.git
cd pygeoapi
#install requirements
pip install -r requirements.txt
pip install -r requirements-dev.txt
# install source in current directory
pip install -e .
cp pygeoapi-config.yml local.config.yml
#edit configuration file
nano local.config.yml
export PYGEOAPI_CONFIG=/path/to/local.config.yml
# generate OpenAPI Document
pygeoapi generate-openapi-document -c local.config.yml > openapi.yml
export PYGEOAPI_OPENAPI=/path/to/openapi.yml
#Run pygeoapi
pygeoapi serve
If the default configuration was used then we should have pygeoapi running on
.. image:: /_static/openapi_intro_page.png