-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Break up deployment docs into separate documents.
- Loading branch information
Showing
7 changed files
with
318 additions
and
308 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
CGI | ||
=== | ||
|
||
If all other deployment methods do not work, CGI will work for sure. CGI | ||
is supported by all major servers but usually has a less-than-optimal | ||
performance. | ||
|
||
This is also the way you can use a Flask application on Google's | ||
`AppEngine`_, there however the execution does happen in a CGI-like | ||
environment. The application's performance is unaffected because of that. | ||
|
||
.. _AppEngine: http://code.google.com/appengine/ | ||
|
||
Creating a `.cgi` file | ||
---------------------- | ||
|
||
First you need to create the CGI application file. Let's call it | ||
`yourapplication.cgi`:: | ||
|
||
#!/usr/bin/python | ||
from wsgiref.handlers import CGIHandler | ||
from yourapplication import app | ||
|
||
CGIHandler().run(app) | ||
|
||
If you're running Python 2.4 you will need the :mod:`wsgiref` package. Python | ||
2.5 and higher ship this as part of the standard library. | ||
|
||
Server Setup | ||
------------ | ||
|
||
Usually there are two ways to configure the server. Either just copy the | ||
`.cgi` into a `cgi-bin` (and use `mod_rerwite` or something similar to | ||
rewrite the URL) or let the server point to the file directly. | ||
|
||
In Apache for example you can put a like like this into the config: | ||
|
||
.. sourcecode:: apache | ||
|
||
ScriptAlias /app /path/to/the/application.cgi | ||
|
||
For more information consult the documentation of your webserver. |
Oops, something went wrong.