Skip to content

Commit 0b1271d

Browse files
committed
Udpate README.md with new changes, new uWSGI and Python 3.5
1 parent cc30f10 commit 0b1271d

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

README.md

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
## Supported tags and respective `Dockerfile` links
22

3-
* [`flask`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/flask/Dockerfile)
3+
* [`flask`, `flask-python2.7`, `latest` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/flask/Dockerfile)
44
* [`flask-index` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/flask-index/Dockerfile)
55
* [`flask-upload` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/flask-upload/Dockerfile)
66
* [`flask-index-upload` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/flask-index-upload/Dockerfile)
7+
* [`flask-python3.5` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/flask-python3.5/Dockerfile)
8+
* [`flask-python3.5-index` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/flask-python3.5-index/Dockerfile)
9+
* [`flask-python3.5-upload` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/flask-python3.5-upload/Dockerfile)
10+
* [`flask-python3.5-index-upload` _(Dockerfile)_](https://github.com/tiangolo/uwsgi-nginx-flask-docker/blob/master/flask-python3.5-index-upload/Dockerfile)
711

812
# uwsgi-nginx-flask
913

10-
**Docker** image with **uWSGI** and **Nginx** for **Flask** web applications in **Python** running in a single container.
14+
**Docker** image with **uWSGI** and **Nginx** for **Flask** web applications in **Python 2.7** and **Python 3.5** running in a single container.
1115

1216
## Description
1317

@@ -21,53 +25,55 @@ uWSGI with Nginx is one of the best ways to deploy a Python web application, so
2125

2226
## Examples (project templates)
2327

24-
* **`flask`** tag (general Flask web application): [**example-flask**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.2/example-flask.zip>)
28+
* **`flask`** tag (general Flask web application): [**example-flask**](<>)
2529

26-
* **`flask-upload`** tag (general Flask web application. Allowing uploads of up to 100 MB.): [**example-flask-upload**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.2/example-flask-upload.zip>)
30+
* *`flask-python3.5`* tag (the equivalent as above, using Python 3.5): [**example-flask-python3.5**](<>)
2731

28-
* **`flask-index`** tag (`static/index.html` served directly in `/`, e.g. for Angular JS): [**example-flask-index**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.2/example-flask-index.zip>)
32+
* **`flask-upload`** tag (general Flask web application. Allowing uploads of up to 100 MB.): [**example-flask-upload**](<>)
2933

30-
* **`flask-index-upload`** tag (`static/index.html` served directly in `/`, e.g. for Angular JS. Allowing uploads of up to 100 MB.): [**example-flask-index-upload**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.2/example-flask-index-upload.zip>)
34+
* *`flask-python3.5-upload`* tag (the equivalent as above, using Python 3.5): [**example-flask-python3.5-upload**](<>)
35+
36+
* **`flask-index`** tag (`static/index.html` served directly in `/`, e.g. for Angular JS): [**example-flask-index**](<>)
37+
38+
* *`flask-python3.5-index`* tag (the equivalent as above, using Python 3.5): [**example-flask-python3.5-index**](<>)
39+
40+
* **`flask-index-upload`** tag (`static/index.html` served directly in `/`, e.g. for Angular JS. Allowing uploads of up to 100 MB.): [**example-flask-index-upload**](<>)
41+
42+
* *`flask-python3.5-index-upload`* tag (the equivalent as above, using Python 3.5): [**example-flask-python3.5-index-upload**](<>)
3143

3244
## General Instructions
3345

3446
You don't have to clone this repo, you should be able to use this image as a base image for your project.
3547

36-
There are four image tags:
48+
There are several image tags, for each one, there's a template repo (a `.zip` file that you can download from above, in the "**Examples**" section):
3749

38-
* **`flask`** (also `latest`): An image based on the [**tiangolo/uwsgi-nginx**](https://hub.docker.com/r/tiangolo/uwsgi-nginx/) image. This image includes Flask and a sample app.
50+
* **`flask`** (also `latest` and `flask-python2.7`): An image based on the [**tiangolo/uwsgi-nginx**](https://hub.docker.com/r/tiangolo/uwsgi-nginx/) image. This image includes Flask and a sample app.
3951

4052
The image [**tiangolo/uwsgi-nginx**](https://hub.docker.com/r/tiangolo/uwsgi-nginx/) has uWSGI and Nginx installed in the same container and is made to be the base of this image.
4153

4254
Use `FROM tiangolo/uwsgi-nginx-flask:flask` in your `Dockerfile` to use this image. (This would be the most general purpose tag image).
4355

44-
You can also use the example template project: [**example-flask**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.1/example-flask.zip>).
45-
4656
* **`flask-upload`**: The same as **`flask`** but configuring Nginx to allow uploads of up to 100 MB (the default is 1 MB).
4757

4858
Use `FROM tiangolo/uwsgi-nginx-flask:flask-upload` in your `Dockerfile` to use this image. (This would be the most general purpose tag image).
4959

50-
You can also use the example template project: [**example-flask-upload**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.2/example-flask-upload.zip>).
51-
5260
* **`flask-index`**: An image based on the **`flask`** image (above), but optimizing the configuration to make Nginx serve `/app/static/index.html` directly (instead of going through uWSGI and your code) when requested for `/`.
5361

5462
This is specially helpful (and efficient) if you are building a single-page app without Jinja2 templates (as with Angular JS) and using Flask as an API / back-end.
5563

5664
Use `FROM tiangolo/uwsgi-nginx-flask:flask-index` in your `Dockerfile` to use this image.
5765

58-
You can also use the example template project: [**example-flask-index**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.1/example-flask-index.zip>).
59-
6066
* **`flask-index-upload`**: The same as **`flask-index`** but configuring Nginx to allow uploads of up to 100 MB (the default is 1 MB).
6167

6268
Use `FROM tiangolo/uwsgi-nginx-flask:flask-index-upload` in your `Dockerfile` to use this image. (This would be the most general purpose tag image).
6369

64-
You can also use the example template project: [**example-flask-index-upload**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.2/example-flask-index-upload.zip>).
70+
* **Python 3.5**: There is a version of all the images and example templates above using Python 3.5. The usage is very similiar to the usage of the normal (Python 2.7) version, but using the equivalent `python3.5` tag (you can see all the available tags on the top). Nevertheless, [Python 2.7 is still the default as the Flask maintainers use it as default and port the code to Python 3.5](http://flask.pocoo.org/docs/0.11/python3/) and Python 2.7 is still the most used and supported version.
6571

6672
## Creating a Flask project with Docker
6773

6874
**Note**: These instructions are for the `flask` tag and are intended for a general purpose Flask web application.
6975

70-
You can download this example and use it as the template for your project: [**example-flask**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.1/example-flask.zip>).
76+
You can download this example and use it as the template for your project: [**example-flask**](<>).
7177

7278
---
7379

@@ -120,7 +126,7 @@ You should be able to check it in your Docker container's URL, for example: <htt
120126

121127
**Note**: These instructions are for the `flask-index` tag and are intended for an application that serves a static `index.html` file, as in an Angular JS application.
122128

123-
You can download this example and use it as the template for your project: [**example-flask-index**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.1/example-flask-index.zip>).
129+
You can download this example and use it as the template for your project: [**example-flask-index**](<>).
124130

125131
---
126132

@@ -198,9 +204,9 @@ docker run -d --name mycontainer -p 80:80 myimage
198204

199205
If you only need to configure Nginx to allow uploads of up to 100 MB, you can use one of the example projects:
200206

201-
* [**example-flask-upload**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.2/example-flask-upload.zip>): With the Docker image tag `flask-upload`, for general purpose Flask web applications with uploads of up to 100 MB (instead of the default 1 MB).
207+
* [**example-flask-upload**](<>): With the Docker image tag `flask-upload`, for general purpose Flask web applications with uploads of up to 100 MB (instead of the default 1 MB).
202208

203-
* [**example-flask-index-upload**](<https://github.com/tiangolo/uwsgi-nginx-flask-docker/releases/download/v0.1.2/example-flask-index-upload.zip>): With the Docker image tag `flask-index-upload`, for Flask web applications that serve `/static/index.html` directly when requested for `/` (useful with Angular JS) and with uploads of up to 100 MB (instead of the default 1 MB).
209+
* [**example-flask-index-upload**](<>): With the Docker image tag `flask-index-upload`, for Flask web applications that serve `/static/index.html` directly when requested for `/` (useful with Angular JS) and with uploads of up to 100 MB (instead of the default 1 MB).
204210

205211
---
206212

@@ -248,13 +254,13 @@ The image (and tags) created by this repo is based on the image [**tiangolo/uwsg
248254

249255
If you follow the instructions and keep the root directory `/app` in your container, with a file named `main.py` and a Flask object named `app` in it, it should "just work".
250256

251-
There's already a `uwsgi.ini` file in the `/app` directory with the uWSGI configurations for it to "just work".
257+
There's already a `uwsgi.ini` file in the `/app` directory with the uWSGI configurations for it to "just work". And even all the other required parameters are in another `uwsgi.ini` file in the image, inside `/etc/uwsgi/`.
252258

253-
If you need to change the main file name or the main Flask object, you would have to provide your own `uwsgi.ini` file. You may use the one in this repo as a template to start with (you only would have to change 2 lines).
259+
If you need to change the main file name or the main Flask object, you would have to provide your own `uwsgi.ini` file. You may use the one in this repo as a template to start with (and you only would have to change the 2 corresponding lines).
254260

255261
You can have a `/app/static` directory and those files will be efficiently served by Nginx directly (without going through your Flask code or even uWSGI), it's already configured for you.
256262

257-
Supervisord takes care of running uWSGI with the `uwsgi.ini` file in `/app` file and starting Nginx.
263+
Supervisord takes care of running uWSGI with the `uwsgi.ini` file in `/app` file (including also the file in `/etc/uwsgi/uwsgi.ini`) and starting Nginx.
258264

259265
---
260266

@@ -298,10 +304,6 @@ But first, as you will be completely replacing the directory `/app` in your cont
298304

299305
```
300306
[uwsgi]
301-
socket = /tmp/uwsgi.sock
302-
chown-socket = nginx:nginx
303-
chmod-socket = 664
304-
305307
module = main
306308
callable = app
307309
```
@@ -338,7 +340,7 @@ docker run -d --name mycontainer -p 80:80 -v $(pwd)/app:/app myimage python /app
338340

339341
Now you can edit your Flask code in your local machine and once you refresh your browser, you will see the changes live.
340342

341-
Remember that you should use this only for debugging and development, for deployment you shouldn't mount volumes and you should let Supervisord start and let it start uWSGI and Nginx (which is what happens by default).
343+
Remember that you should use this only for debugging and development, for deployment in production you shouldn't mount volumes and you should let Supervisord start and let it start uWSGI and Nginx (which is what happens by default).
342344

343345
For these last steps to work (live debugging and development), your Python Flask code should have that section with:
344346

0 commit comments

Comments
 (0)