mirror of
https://github.com/cytopia/devilbox.git
synced 2025-02-21 01:42:14 +00:00
Documentation: Python Flask
This commit is contained in:
parent
bc16d8906e
commit
f7741d88f9
@ -21,3 +21,5 @@
|
||||
+-------------------------------------+-----------+-----------+----------------+
|
||||
| ELK: Kibana | kibana | kibana | 172.16.238.242 |
|
||||
+-------------------------------------+-----------+-----------+----------------+
|
||||
| Python Flask | flask1 | flask1 | 172.16.238.250 |
|
||||
+-------------------------------------+-----------+-----------+----------------+
|
||||
|
@ -13,11 +13,12 @@ However, each example also exists in its standalone file as shown below:
|
||||
├── docker-compose.override.yml-elk
|
||||
├── docker-compose.override.yml-mailhog
|
||||
├── docker-compose.override.yml-ngrok
|
||||
├── docker-compose.override.yml-python-flask
|
||||
├── docker-compose.override.yml-rabbitmq
|
||||
├── docker-compose.override.yml-solr
|
||||
├── docker-compose.override.yml-varnish
|
||||
└── README.md
|
||||
|
||||
0 directories, 8 files
|
||||
0 directories, 10 files
|
||||
|
||||
.. seealso:: :ref:`custom_container_enable_all_additional_container`
|
||||
|
149
docs/custom-container/enable-python-flask.rst
Normal file
149
docs/custom-container/enable-python-flask.rst
Normal file
@ -0,0 +1,149 @@
|
||||
.. include:: /_includes/all.rst
|
||||
.. include:: /_includes/snippets/__ANNOUNCEMENTS__.rst
|
||||
|
||||
.. _custom_container_enable_python_flask:
|
||||
|
||||
*********************************
|
||||
Enable and configure Python Flask
|
||||
*********************************
|
||||
|
||||
This section will guide you through getting Python Flask integrated into the Devilbox.
|
||||
|
||||
.. seealso::
|
||||
* :ref:`example_setup_reverse_proxy_python_flask`
|
||||
* :ref:`custom_container_enable_all_additional_container`
|
||||
* :ref:`docker_compose_override_yml_how_does_it_work`
|
||||
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
Available overwrites
|
||||
--------------------
|
||||
|
||||
.. include:: /_includes/snippets/docker-compose-override-tree-view.rst
|
||||
|
||||
|
||||
Python Flask settings
|
||||
---------------------
|
||||
|
||||
In case of Python Flask, the file is ``compose/docker-compose.override.yml-python-flask``. This file
|
||||
must be copied into the root of the Devilbox git directory.
|
||||
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| What | How and where |
|
||||
+=======================+==========================================================================================================+
|
||||
| Example compose file | ``compose/docker-compose.override.yml-all`` or |br| ``compose/docker-compose.override.yml-python-flask`` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Container IP address | ``172.16.238.250`` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Container host name | ``flask1`` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Container name | ``flask1`` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Mount points | ``data/www``` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Exposed port | none |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Available at | Devilbox intranet via Reverse Proxy configuration |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Further configuration | :ref:`example_setup_reverse_proxy_python_flask` |
|
||||
+-----------------------+----------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Python Flask env variables
|
||||
--------------------------
|
||||
|
||||
Additionally the following ``.env`` variables can be created for easy configuration:
|
||||
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| Variable | Default value | Description |
|
||||
+==============================+===================+============================================================================+
|
||||
| ``FLASK_PROJECT`` | none | Specifies your Python Flask project dir in data/www. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
| ``PYTHON_VERSION`` | ``3.8`` | Specifies the Python version to use for Flask. |
|
||||
+------------------------------+-------------------+----------------------------------------------------------------------------+
|
||||
|
||||
|
||||
Instructions
|
||||
============
|
||||
|
||||
1. Copy docker-compose.override.yml
|
||||
-----------------------------------
|
||||
|
||||
Copy the Python Flask Docker Compose overwrite file into the root of the Devilbox git directory.
|
||||
(It must be at the same level as the default ``docker-compose.yml`` file).
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cp compose/docker-compose.override.yml-python-flask docker-compose.override.yml
|
||||
|
||||
.. seealso::
|
||||
* :ref:`docker_compose_override_yml`
|
||||
* :ref:`add_your_own_docker_image`
|
||||
* :ref:`overwrite_existing_docker_image`
|
||||
|
||||
|
||||
2. Adjust ``.env`` settings (optional)
|
||||
--------------------------------------
|
||||
|
||||
Python Flask is using sane defaults, which can be changed by adding variables to the ``.env`` file
|
||||
and assigning custom values.
|
||||
|
||||
Add the following variables to ``.env`` and adjust them to your needs:
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: .env
|
||||
|
||||
# Project directory in data/www
|
||||
FLASK_PROJECT=my-flask
|
||||
|
||||
# Python version to choose
|
||||
#PYTHON_VERSION=2.7
|
||||
#PYTHON_VERSION=3.5
|
||||
#PYTHON_VERSION=3.6
|
||||
#PYTHON_VERSION=3.7
|
||||
PYTHON_VERSION=3.8
|
||||
|
||||
.. seealso:: :ref:`env_file`
|
||||
|
||||
|
||||
3. Configure Reverse Proxy
|
||||
--------------------------
|
||||
|
||||
Before starting up the devilbox you will need to configure your python flask project and the
|
||||
reverse proxy settings.
|
||||
|
||||
.. seealso:: :ref:`example_setup_reverse_proxy_python_flask`
|
||||
|
||||
|
||||
TL;DR
|
||||
=====
|
||||
|
||||
For the lazy readers, here are all commands required to get you started.
|
||||
Simply copy and paste the following block into your terminal from the root of your Devilbox git
|
||||
directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Copy compose-override.yml into place
|
||||
cp compose/docker-compose.override.yml-flask1 docker-compose.override.yml
|
||||
|
||||
# Create .env variable
|
||||
echo "# Project directory in data/www" > .env
|
||||
echo "FLASK_PROJECT=my-flask" >> .env
|
||||
echo "# Python version to choose" >> .env
|
||||
echo "#PYTHON_VERSION=2.7" >> .env
|
||||
echo "#PYTHON_VERSION=3.5" >> .env
|
||||
echo "#PYTHON_VERSION=3.6" >> .env
|
||||
echo "#PYTHON_VERSION=3.7" >> .env
|
||||
echo "PYTHON_VERSION=3.8" >> .env
|
||||
|
||||
before starting up the devilbox you will need to configure your python flask project and the
|
||||
reverse proxy settings.
|
||||
|
||||
.. seealso:: :ref:`example_setup_reverse_proxy_python_flask`
|
449
docs/examples/setup-reverse-proxy-python-flask.rst
Normal file
449
docs/examples/setup-reverse-proxy-python-flask.rst
Normal file
@ -0,0 +1,449 @@
|
||||
.. include:: /_includes/all.rst
|
||||
.. include:: /_includes/snippets/__ANNOUNCEMENTS__.rst
|
||||
|
||||
.. _example_setup_reverse_proxy_python_flask:
|
||||
|
||||
********************************
|
||||
Setup reverse proxy Python Flask
|
||||
********************************
|
||||
|
||||
This example will walk you through adding a version specific Python Flask docker container,
|
||||
creating a simple Flask hello world application and have its requirements specified in
|
||||
``requirements.txt`` automatically installed. Once setup, your application will be ready via
|
||||
``docker-compose up``, proxied to the web server and can be reached via valid HTTPS.
|
||||
|
||||
|
||||
.. note::
|
||||
This example is using an additional Docker image, so you are able to specify any Python version
|
||||
you like and even be able to add multiple Docker images with different versions.
|
||||
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
.. contents:: :local:
|
||||
|
||||
Overview
|
||||
========
|
||||
|
||||
The following configuration will be used:
|
||||
|
||||
+--------------+--------------------------+-------------+------------+-----------------------------------------------+
|
||||
| Project name | VirtualHost directory | Database | TLD_SUFFIX | Project URL |
|
||||
+==============+==========================+=============+============+===============================================+
|
||||
| my-flask | /shared/httpd/my-flask | - | loc | http://my-flask.loc |br| https://my-flask.loc |
|
||||
+--------------+--------------------------+-------------+------------+-----------------------------------------------+
|
||||
|
||||
.. note::
|
||||
* Inside the Devilbox PHP container, projects are always in ``/shared/httpd/``.
|
||||
* On your host operating system, projects are by default in ``./data/www/`` inside the
|
||||
Devilbox git directory. This path can be changed via :ref:`env_httpd_datadir`.
|
||||
|
||||
The following Devilbox configuration is required:
|
||||
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
| Service | Implications |
|
||||
+==============+================================================================================================+
|
||||
| Webserver | Reverse proxy vhost-gen template need to be applied |
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
| Python Flask | Docker Compose override file must be applied. |
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
| ``.env`` | ``FLASK_PROJECT`` variable must be declared and set. |
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
| ``.env`` | ``PYTHON_VERSION`` variable can be declared and set. |
|
||||
+--------------+------------------------------------------------------------------------------------------------+
|
||||
|
||||
Additionally we will set the listening port of the Flask appliation to ``3000``.
|
||||
|
||||
.. seealso::
|
||||
For a detailed overview about the Compose file see: :ref:`custom_container_enable_python_flask`
|
||||
|
||||
|
||||
Walk through
|
||||
============
|
||||
|
||||
It will be ready in ten simple steps:
|
||||
|
||||
1. Configure Python Flask project name and versoin
|
||||
2. Enter the PHP container
|
||||
3. Create a new VirtualHost directory
|
||||
4. Create Flask hello world application
|
||||
5. Symlink *virtual* docroot directory
|
||||
6. Add reverse proxy vhost-gen config files
|
||||
7. Copy Python Flask compose file
|
||||
8. Setup DNS record
|
||||
9. Restart the Devilbox
|
||||
10. Visit http://my-flask.loc in your browser
|
||||
|
||||
|
||||
1. Configure Python Flask project name and version
|
||||
--------------------------------------------------
|
||||
|
||||
The Python Flask container will only serve a single project. In order for it to know where
|
||||
to find your project, you will have to add an environment variable (``FLASK_PROJECT``),
|
||||
telling it what the directory name of your project is.
|
||||
|
||||
Additionally you can define the Python version (``PYTHON_VERSION``) under which you want to run
|
||||
your Flask project.
|
||||
|
||||
.. seealso:: Available Python versions can be seen here: https://github.com/devilbox/docker-python-flask
|
||||
|
||||
Add the following variable to the very end of your ``.env`` file:
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: .env
|
||||
|
||||
FLASK_PROJECT=my-flask
|
||||
|
||||
#PYTHON_VERSION=2.7
|
||||
#PYTHON_VERSION=3.5
|
||||
#PYTHON_VERSION=3.6
|
||||
#PYTHON_VERSION=3.7
|
||||
PYTHON_VERSION=3.8
|
||||
|
||||
|
||||
2. Enter the PHP container
|
||||
--------------------------
|
||||
|
||||
All work will be done inside the PHP container as it provides you with all required command line
|
||||
tools.
|
||||
|
||||
Navigate to the Devilbox git directory and execute ``shell.sh`` (or ``shell.bat`` on Windows) to
|
||||
enter the running PHP container.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> ./shell.sh
|
||||
|
||||
.. seealso::
|
||||
* :ref:`enter_the_php_container`
|
||||
* :ref:`work_inside_the_php_container`
|
||||
* :ref:`available_tools`
|
||||
|
||||
|
||||
3. Create new VirtualHost directory
|
||||
-----------------------------------
|
||||
|
||||
The vhost directory defines the name under which your project will be available. |br|
|
||||
( ``<vhost dir>.TLD_SUFFIX`` will be the final URL ).
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-flask
|
||||
|
||||
.. seealso:: :ref:`env_tld_suffix`
|
||||
|
||||
|
||||
4. Create Flask hello world application
|
||||
---------------------------------------
|
||||
|
||||
4.1 Add your code
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to your project directory
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-flask
|
||||
|
||||
# Create a directory which will hold the source code
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask $ mkdir app
|
||||
|
||||
# Create the main.py file with your favourite editor
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask/app $ vi main.py
|
||||
|
||||
.. code-block:: python
|
||||
:caption: main.py
|
||||
|
||||
"""Flask example application."""
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
"""Serve the default index page."""
|
||||
return "Hello World!"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
"""Ensure Flask listens on all interfaces."""
|
||||
app.run(host='0.0.0.0')
|
||||
|
||||
4.2 Add dependencies
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
You can optionally add a ``requirements.txt`` file which will be read during startup. The Python
|
||||
Flask container will then automatically install all Python libraries specified in that file.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to your project directory
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-flask
|
||||
|
||||
# Create and open the file with your favourite editor
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask $ vi requirements.txt
|
||||
|
||||
.. code-block:: ini
|
||||
:caption: data/www/my-flask/requirements.txt
|
||||
|
||||
requests
|
||||
|
||||
|
||||
5. Symlink *virtual* docroot directory
|
||||
--------------------------------------
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to your project directory
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-flask
|
||||
|
||||
# Create the docroot directory
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask $ ln -s app htdocs
|
||||
|
||||
.. seealso:: :ref:`env_httpd_docroot_dir`
|
||||
|
||||
|
||||
6. Add reverse proxy vhost-gen config files
|
||||
-------------------------------------------
|
||||
|
||||
6.1 Create vhost-gen template directory
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Before we can copy the vhost-gen templates, we must create the ``.devilbox`` template directory
|
||||
inside the project directory.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Navigate to your project directory
|
||||
devilbox@php-7.0.20 in /shared/httpd $ cd my-flask
|
||||
|
||||
# Create the .devilbox template directory
|
||||
devilbox@php-7.0.20 in /shared/httpd/my-flask $ mkdir .devilbox
|
||||
|
||||
|
||||
.. seealso:: :ref:`env_httpd_template_dir`
|
||||
|
||||
6.2 Copy vhost-gen templates
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Now we can copy and adjust the vhost-gen reverse proxy files for Apache 2.2, Apache 2.4 and Nginx.
|
||||
|
||||
|
||||
The reverse vhost-gen templates are available in ``cfg/vhost-gen``:
|
||||
|
||||
.. code-block:: bash
|
||||
:emphasize-lines: 4,6,8
|
||||
|
||||
host> tree -L 1 cfg/vhost-gen/
|
||||
|
||||
cfg/vhost-gen/
|
||||
├── apache22.yml-example-rproxy
|
||||
├── apache22.yml-example-vhost
|
||||
├── apache24.yml-example-rproxy
|
||||
├── apache24.yml-example-vhost
|
||||
├── nginx.yml-example-rproxy
|
||||
├── nginx.yml-example-vhost
|
||||
└── README.md
|
||||
|
||||
0 directories, 7 files
|
||||
|
||||
For this example we will copy all ``*-example-rproxy`` files into ``data/www/my-flask/.devilbox/``
|
||||
(Inside container: ``/shared/httpd/my-flask/.devilbox``) to ensure this will work with all web servers.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> cp cfg/vhost-gen/apache22.yml-example-rproxy data/www/my-flask/.devilbox/apache22.yml
|
||||
host> cp cfg/vhost-gen/apache24.yml-example-rproxy data/www/my-flask/.devilbox/apache24.yml
|
||||
host> cp cfg/vhost-gen/nginx.yml-example-rproxy data/www/my-flask/.devilbox/nginx.yml
|
||||
|
||||
|
||||
6.3 Adjust ports and backend
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
By default, all vhost-gen templates will forward requests to port ``8000`` into the PHP container.
|
||||
Our current example however uses port ``3000`` and backend IP ``172.16.238.250`` (as defined
|
||||
in the Flask docker compose override file), so we must change that accordingly for all three
|
||||
templates.
|
||||
|
||||
6.3.1 Adjust Apache 2.2 template
|
||||
""""""""""""""""""""""""""""""""
|
||||
|
||||
Open the ``apache22.yml`` vhost-gen template in your project:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> vi data/www/my-flask/.devilbox/apache22.yml
|
||||
|
||||
|
||||
Find the two lines with ``ProxyPass`` and ``ProxyPassReverse`` and change the port from ``8000``
|
||||
to ``3000`` as well as the backend server from ``php`` to ``172.16.238.250``.
|
||||
|
||||
.. code-block:: yaml
|
||||
:caption: data/www/my-flask/.devilbox/apache22.yml
|
||||
:emphasize-lines: 16,17
|
||||
|
||||
# ... more lines above ... #
|
||||
|
||||
###
|
||||
### Basic vHost skeleton
|
||||
###
|
||||
vhost: |
|
||||
<VirtualHost __DEFAULT_VHOST__:__PORT__>
|
||||
ServerName __VHOST_NAME__
|
||||
|
||||
CustomLog "__ACCESS_LOG__" combined
|
||||
ErrorLog "__ERROR_LOG__"
|
||||
|
||||
# Reverse Proxy definition (Ensure to adjust the port, currently '8000')
|
||||
ProxyRequests On
|
||||
ProxyPreserveHost On
|
||||
ProxyPass / http://172.16.238.250:3000/
|
||||
ProxyPassReverse / http://172.16.238.250:3000/
|
||||
|
||||
# ... more lines below ... #
|
||||
|
||||
6.3.2 Adjust Apache 2.4 template
|
||||
""""""""""""""""""""""""""""""""
|
||||
|
||||
Open the ``apache24.yml`` vhost-gen template in your project:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> vi data/www/my-flask/.devilbox/apache24.yml
|
||||
|
||||
|
||||
Find the two lines with ``ProxyPass`` and ``ProxyPassReverse`` and change the port from ``8000``
|
||||
to ``3000``
|
||||
|
||||
.. code-block:: yaml
|
||||
:caption: data/www/my-flask/.devilbox/apache24.yml
|
||||
:emphasize-lines: 16,17
|
||||
|
||||
# ... more lines above ... #
|
||||
|
||||
###
|
||||
### Basic vHost skeleton
|
||||
###
|
||||
vhost: |
|
||||
<VirtualHost __DEFAULT_VHOST__:__PORT__>
|
||||
ServerName __VHOST_NAME__
|
||||
|
||||
CustomLog "__ACCESS_LOG__" combined
|
||||
ErrorLog "__ERROR_LOG__"
|
||||
|
||||
# Reverse Proxy definition (Ensure to adjust the port, currently '8000')
|
||||
ProxyRequests On
|
||||
ProxyPreserveHost On
|
||||
ProxyPass / http://172.16.238.250:3000/
|
||||
ProxyPassReverse / http://172.16.238.250:3000/
|
||||
|
||||
# ... more lines below ... #
|
||||
|
||||
6.3.3 Adjust Nginx template
|
||||
"""""""""""""""""""""""""""
|
||||
|
||||
Open the ``nginx.yml`` vhost-gen template in your project:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> vi data/www/my-flask/.devilbox/nginx.yml
|
||||
|
||||
|
||||
Find the lines with ``proxy_pass`` and change the port from ``8000`` to ``3000``
|
||||
|
||||
.. code-block:: yaml
|
||||
:caption: data/www/my-flask/.devilbox/nginx.yml
|
||||
:emphasize-lines: 18
|
||||
|
||||
# ... more lines above ... #
|
||||
|
||||
###
|
||||
### Basic vHost skeleton
|
||||
###
|
||||
vhost: |
|
||||
server {
|
||||
listen __PORT____DEFAULT_VHOST__;
|
||||
server_name __VHOST_NAME__;
|
||||
|
||||
access_log "__ACCESS_LOG__" combined;
|
||||
error_log "__ERROR_LOG__" warn;
|
||||
|
||||
# Reverse Proxy definition (Ensure to adjust the port, currently '8000')
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass http://172.16.238.250:3000;
|
||||
}
|
||||
|
||||
# ... more lines below ... #
|
||||
|
||||
|
||||
7. Copy Python Flask compose file
|
||||
---------------------------------
|
||||
|
||||
Python Flask comes with its own Docker container and can be added to the Devilbox stack via
|
||||
the ``docker-compose.override.yml`` file. A fully functional template already exists in the
|
||||
``compose/`` directory. All you will have to do is copy it over.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
host> cp compose/docker-compose.override.yml-python-flask.yml docker-compose.override.yml
|
||||
|
||||
.. seealso:: :ref:`docker_compose_override_yml`
|
||||
|
||||
|
||||
8. DNS record
|
||||
-------------
|
||||
|
||||
If you **have** Auto DNS configured already, you can skip this section, because DNS entries will
|
||||
be available automatically by the bundled DNS server.
|
||||
|
||||
If you **don't have** Auto DNS configured, you will need to add the following line to your
|
||||
host operating systems ``/etc/hosts`` file (or ``C:\Windows\System32\drivers\etc`` on Windows):
|
||||
|
||||
.. code-block:: bash
|
||||
:caption: /etc/hosts
|
||||
|
||||
127.0.0.1 my-flask.loc
|
||||
|
||||
.. seealso::
|
||||
|
||||
* :ref:`howto_add_project_hosts_entry_on_mac`
|
||||
* :ref:`howto_add_project_hosts_entry_on_win`
|
||||
* :ref:`setup_auto_dns`
|
||||
|
||||
|
||||
9. Restart the Devilbox
|
||||
-----------------------
|
||||
|
||||
Now for those changes to take affect, you will have to restart the Devilbox.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
host> cd /path/to/devilbox
|
||||
|
||||
# Stop the Devilbox
|
||||
host> docker-compose down
|
||||
host> docker-compose rm -f
|
||||
|
||||
# Start the Devilbox
|
||||
host> docker-compose up -d php httpd bind flask1
|
||||
|
||||
|
||||
10. Open your browser
|
||||
---------------------
|
||||
|
||||
All set now, you can visit http://my-flask.loc or https://my-flask.loc in your browser.
|
||||
The Python Flask application has been started up automatically and the reverse proxy will direct all
|
||||
requests to it.
|
||||
|
||||
|
||||
|
||||
Next steps
|
||||
==========
|
||||
|
||||
.. include:: /_includes/snippets/examples/next-steps.rst
|
@ -122,6 +122,7 @@ host is ready to be served with your custom domain.
|
||||
custom-container/enable-elk-stack
|
||||
custom-container/enable-mailhog
|
||||
custom-container/enable-ngrok
|
||||
custom-container/enable-python-flask
|
||||
custom-container/enable-rabbitmq
|
||||
custom-container/enable-solr
|
||||
custom-container/enable-varnish
|
||||
@ -200,6 +201,7 @@ host is ready to be served with your custom domain.
|
||||
|
||||
examples/setup-reverse-proxy-nodejs
|
||||
examples/setup-reverse-proxy-sphinx-docs
|
||||
examples/setup-reverse-proxy-python-flask
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
Loading…
x
Reference in New Issue
Block a user