Added troubleshooting infos. This fixes #44
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parent 664c64e · Browse files · 5 files·+79 added−4 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+79 added−4 removed
- other:+79 added−4 removed
Provenance
- Commit
cc8332e- Tree
5059c11- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
664c64e
5 files changed+79 added−4 removed
modified:docs/deploying/cgi.rst+8 added
7 unmodified lines8 This is also the way you can use a Flask application on Google's9 `AppEngine`_, there however the execution does happen in a CGI-like10 environment. The application's performance is unaffected because of that.11 12+.. admonition:: Watch Out13+14+ Please make sure in advance that your ``app.run()`` call you might15+ have in your application file, is inside an ``if __name__ ==16+ '__main__':`` or moved to a separate file. Just make sure it's not17+ called because this will always start a local WSGI server which we do18+ not want if we deploy that application to CGI / appengine.19+20 .. _AppEngine: http://code.google.com/appengine/21 22 Creating a `.cgi` file23 ----------------------27 unmodified linesmodified:docs/deploying/fastcgi.rst+11 added-1 removed
6 unmodified lines7 8 The most popular one is `flup`_ which we will use for this guide. Make9 sure to have it installed.10 11+.. admonition:: Watch Out12+13+ Please make sure in advance that your ``app.run()`` call you might14+ have in your application file, is inside an ``if __name__ ==15+ '__main__':`` or moved to a separate file. Just make sure it's not16+ called because this will always start a local WSGI server which we do17+ not want if we deploy that application to FastCGI.18+19 Creating a `.fcgi` file20 -----------------------21 22 First you need to create the FastCGI server file. Let's call it19 unmodified lines42 It makes sense to have that in `/var/www/yourapplication` or something43 similar.44 45 Make sure to set the executable bit on that file so that the servers38-can execute it::46+can execute it:47 48+.. sourcecode:: text49+50 # chmod +x /var/www/yourapplication/yourapplication.fcgi51 52 Configuring lighttpd53 --------------------85 unmodified linesmodified:docs/deploying/mod_wsgi.rst+59 added-2 removed
1 unmodified line2 =================3 4 If you are using the `Apache`_ webserver you should consider using `mod_wsgi`_.5 6+.. admonition:: Watch Out7+8+ Please make sure in advance that your ``app.run()`` call you might9+ have in your application file, is inside an ``if __name__ ==10+ '__main__':`` or moved to a separate file. Just make sure it's not11+ called because this will always start a local WSGI server which we do12+ not want if we deploy that application to mod_wsgi.13+14 .. _Apache: http://httpd.apache.org/15 16 Installing `mod_wsgi`17 ---------------------3 unmodified lines21 22 The mod_wsgi `installation instructions`_ cover source installations on UNIX 23 systems.24 17-If you are using ubuntu / debian you can apt-get it and activate it as follows::25+If you are using ubuntu / debian you can apt-get it and activate it as follows:26 27+.. sourcecode:: text28+29 # apt-get install libapache2-mod-wsgi30 31 On FreeBSD install `mod_wsgi` by compiling the `www/mod_wsgi` port or by using22-pkg_add::32+pkg_add:33 34+.. sourcecode:: text35+36 # pkg_add -r mod_wsgi37 38 If you are using pkgsrc you can install `mod_wsgi` by compiling the39 `www/ap2-wsgi` package.49 unmodified lines89 .. _mod_wsgi: http://code.google.com/p/modwsgi/90 .. _installation instructions: http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide91 .. _virtual python: http://pypi.python.org/pypi/virtualenv92 .. _mod_wsgi wiki: http://code.google.com/p/modwsgi/wiki/93+94+.. _*95+96+Toubleshooting97+--------------98+99+If your application does not run, follow this guide to troubleshoot:100+101+**Problem:** Application does not run, errorlog shows SystemExit ignored102+ You have a ``app.run()`` call in your application file that is not103+ guarded by an ``if __name__ == '__main__':`` condition. Either remove104+ that :meth:`~flask.Flask.run` call from the file and move it into a105+ separate `run.py` file or put it into such an if block.106+107+**Problem:** application gives permission errors108+ Probably caused by your application running as the wrong user. Make109+ sure the folders the application needs access to have the proper110+ privileges set and the application runs as the correct user (``user``111+ and ``group`` parameter to the `WSGIDaemonProcess` directive)112+113+**Problem:** application dies with an error on print114+ Keep in mind that mod_wsgi disallows doing anything with115+ :data:`sys.stdout` and :data:`sys.stderr`. You can disable this116+ protection from the config by setting the `WSGIRestrictStdout` to117+ ``off``:118+119+ .. sourcecode:: apache120+121+ WSGIRestrictStdout Off122+123+ Alternatively you can also replace the standard out in the .wsgi file124+ with a different stream::125+126+ import sys127+ sys.stdout = sys.stderr128+129+**Problem:** accessing resources gives IO errors130+ Your application probably is a single .py file you symlinked into the131+ site-packages folder. Please be aware that this does not work,132+ instead you either have to put the folder into the pythonpath the file133+ is stored in, or convert your application into a package.134+135+ The reason for this is that for non-installed Packages, the module136+ filename is used to locate the resources and for symlinks the wrong137+ filename is picked up.modified:docs/_themesnot shown
Its text is not shown, modified.
modified:docs/flaskstyle.sty+1 added-1 removed
93 unmodified lines94 \fi95 \MakeUppercase{\rm\Huge #2}%96 \markboth{}{}\par}%97 \nobreak98- \vskip 3ex98+ \vskip 8ex99 \@afterheading}100 \def\@spart#1{%101 {\parindent \z@ \center102 \interlinepenalty \@M16 unmodified lines