Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
add a method for production server, using twistd as WSGI container
Browse files Browse the repository at this point in the history
update setup guide
  • Loading branch information
lordfriend committed May 29, 2016
1 parent 0080875 commit ee2d077
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ alembic.ini
*.pyc
.vagrant
.cache
twistd.pid
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
##Breaking Changes
- get bangumi api now return all episodes of this bangumi. access it with `episodes` field
- init db using sql script is not recommended, using tools.py to init db.
- ffmpeg is now a dependency to generate thumbnail for episode
- ffmpeg is now a dependency to generate thumbnail for episode
- server.py now only used in development, when deploying in production, use `twistd -n web --port 5000 --wsgi appd.app`
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,17 @@ vagrant ssh

## Server

the server is a flask app which provide http API for management and end user page (planned but not added currently).
the server is a flask app which provide http API for management and end user page (currently not completed).

In development mode, using flask built-in server:

To start the server, run `python server.py`, if you set the environment variable DEBUG=True, the debug info will be print to log
run `python server.py`, if you set the environment variable DEBUG=True, the debug info will be print to log

In production mode, using twistd as WSGI container

```shell
twistd -n web --port 5000 --wsgi appd.app
```

### HTTP API

Expand Down
5 changes: 5 additions & 0 deletions appd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from twisted.web.wsgi import WSGIResource
from twisted.internet import reactor
from server import app

resource = WSGIResource(reactor, reactor.getThreadPool(), app)
1 change: 1 addition & 0 deletions config/config-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ feedparser:
# ftp: http://127.0.0.1:8000/

# Setting a different domain for resource will speed up your page load
# a scheme is required, e.g. https://static.example.com
# this is optional
domain:
image: # the image domain for your image resource, such as thumbnails and cover
Expand Down

0 comments on commit ee2d077

Please sign in to comment.