This commit is contained in:
2017-05-17 15:08:50 -04:00
parent 8f41a28963
commit a078a46299
4 changed files with 12 additions and 10 deletions
+1
View File
@@ -10,3 +10,4 @@ crayons = "*"
maya = "*"
Flask-Compress = "*"
Flask-Cache = "*"
meinheld = "*"
+8 -8
View File
@@ -25,9 +25,9 @@ if __name__ == "__main__":
common.serve()
```
Next:
Next:
- Put a `favicon.ico` in your `static` folder.
- Put a `favicon.ico` in your `static` folder.
- Enjoy!
## Nicities
@@ -39,17 +39,17 @@ HTTP Headers:
Other nice things:
- `@common.cache.cached(timeout=50)` decorator for caching views in memory.
- `@common.cache.cached(timeout=50)` decorator for caching views in memory.
- Favicon support (`/favicon.ico` redirects to `/static/favicon.ico`).
## Web Server: Gunicorn
## Web Server: Gunicorn + Meinheld
Automatically uses Gunicorn for production (when `Flask.debug = False`), Flask's dev server for development.
Automatically uses Gunicorn + Meinheld for production (when `Flask.debug = False`), Flask's dev server for development.
Configuration environment variables:
- `WEB_CONCURRENCY` for specifying the number of synchronous gunicorn workers.
- `PORT` for binding to a specific port.
- `WEB_CONCURRENCY` for specifying the number of synchronous gunicorn workers.
- `PORT` for binding to a specific port.
## File Server: WhiteNoise
@@ -60,4 +60,4 @@ Flask-Common automatically configures [WhiteNoise](http://whitenoise.evans.io) t
app.config['COMMON_FILESERVER_DISABLED'] = 1
app.config['COMMON_POWERED_BY_DISABLED'] = 1
app.config['COMMON_PROCESSED_TIME_DISABLED'] = 1
+1 -1
View File
@@ -140,6 +140,6 @@ class Common(object):
print(crayons.yellow('Booting Gunicorn...'))
# Start the web server.
server = GunicornServer(self.app, workers=workers or number_of_gunicorn_workers(), **kwargs)
server = GunicornServer(self.app, workers=workers or number_of_gunicorn_workers(), worker_class='egg:meinheld#gunicorn_worker', **kwargs)
server.run()
+2 -1
View File
@@ -33,7 +33,8 @@ setup(
'WhiteNoise',
'crayons',
'maya',
'flask_cache'
'flask_cache',
'meinheld'
],
classifiers=[
'Environment :: Web Environment',