Skip to content
Myr

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

5 files+79 added−4 removed

modified:docs/deploying/cgi.rst+8 added
7 unmodified lines
8This is also the way you can use a Flask application on Google's9`AppEngine`_, there however the execution does happen in a CGI-like10environment. The application's performance is unaffected because of that.1112.. admonition:: Watch Out1314 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.1920.. _AppEngine: http://code.google.com/appengine/2122Creating a `.cgi` file23----------------------
27 unmodified lines
modified:docs/deploying/fastcgi.rst+11 added-1 removed
6 unmodified lines
78The most popular one is `flup`_ which we will use for this guide. Make9sure to have it installed.1011.. admonition:: Watch Out1213 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.1819Creating a `.fcgi` file20-----------------------2122First you need to create the FastCGI server file. Let's call it
19 unmodified lines
42It makes sense to have that in `/var/www/yourapplication` or something43similar.4445Make sure to set the executable bit on that file so that the servers38can execute it::46can execute it:4748.. sourcecode:: text4950 # chmod +x /var/www/yourapplication/yourapplication.fcgi5152Configuring lighttpd53--------------------
85 unmodified lines
modified:docs/deploying/mod_wsgi.rst+59 added-2 removed
1 unmodified line
2=================34If you are using the `Apache`_ webserver you should consider using `mod_wsgi`_.56.. admonition:: Watch Out78 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.1314.. _Apache: http://httpd.apache.org/1516Installing `mod_wsgi`17---------------------
3 unmodified lines
2122The mod_wsgi `installation instructions`_ cover source installations on UNIX 23systems.2417If you are using ubuntu / debian you can apt-get it and activate it as follows::25If you are using ubuntu / debian you can apt-get it and activate it as follows:2627.. sourcecode:: text2829 # apt-get install libapache2-mod-wsgi3031On FreeBSD install `mod_wsgi` by compiling the `www/mod_wsgi` port or by using22pkg_add::32pkg_add:3334.. sourcecode:: text3536 # pkg_add -r mod_wsgi3738If you are using pkgsrc you can install `mod_wsgi` by compiling the39`www/ap2-wsgi` package.
49 unmodified lines
89.. _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/9394.. _*9596Toubleshooting97--------------9899If your application does not run, follow this guide to troubleshoot:100101**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.106107**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)112113**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``:118119 .. sourcecode:: apache120121 WSGIRestrictStdout Off122123 Alternatively you can also replace the standard out in the .wsgi file124 with a different stream::125126 import sys127 sys.stdout = sys.stderr128129**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.134135 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 lines
94 \fi95 \MakeUppercase{\rm\Huge #2}%96 \markboth{}{}\par}%97 \nobreak98 \vskip 3ex98 \vskip 8ex99 \@afterheading}100\def\@spart#1{%101 {\parindent \z@ \center102 \interlinepenalty \@M
16 unmodified lines