Error No Module Named Flup
Contents |
(fixed) Latest flup removes Python 2 compatibility Reported by: ayleph Owned by: Priority: minor Milestone: 0.9.0 Component: infrastructure Keywords: upstream, flup, python2 Cc: Parent Tickets: Description We recommend installing
Pip Install Flup
flup [1] for fcgi deployments. The latest version of flup on python flup PyPI [2] claims to be a "Python 3.x-only version." Two people have reported issues with this version
Wsgiserver: Missing Fastcgi Param Request_method Required By Wsgi!
of flup in a Python 2 installation. One person shared the following log on IRC. File "build/bdist.linux-x86_64/egg/flup/server/paste_factory.py", line 125, in run_fcgi_fork File "build/bdist.linux-x86_64/egg/flup/server/fcgi_fork.py", line 60, in
To use your WSGI application with any of them you will need a FastCGI server first. The most popular one is flup
Django Fastcgi
which we will use for this guide. Make sure to have python wsgi it installed to follow along. Watch Out Please make sure in advance that any app.run() calls
Scgi
you might have in your application file are inside an if __name__ == '__main__': block or moved to a separate file. Just make sure https://issues.mediagoblin.org/ticket/5373 it's not called because this will always start a local WSGI server which we do not want if we deploy that application to FastCGI. Creating a .fcgi file¶ First you need to create the FastCGI server file. Let's call it yourapplication.fcgi: #!/usr/bin/python from flup.server.fcgi import WSGIServer from yourapplication import app if __name__ == '__main__': WSGIServer(app).run() This http://flask.pocoo.org/docs/latest/deploying/fastcgi/ is enough for Apache to work, however nginx and older versions of lighttpd need a socket to be explicitly passed to communicate with the FastCGI server. For that to work you need to pass the path to the socket to the WSGIServer: WSGIServer(application, bindAddress='/path/to/fcgi.sock').run() The path has to be the exact same path you define in the server config. Save the yourapplication.fcgi file somewhere you will find it again. It makes sense to have that in /var/www/yourapplication or something similar. Make sure to set the executable bit on that file so that the servers can execute it: # chmod +x /var/www/yourapplication/yourapplication.fcgi Configuring Apache¶ The example above is good enough for a basic Apache deployment but your .fcgi file will appear in your application URL e.g. example.com/yourapplication.fcgi/news/. There are few ways to configure your application so that yourapplication.fcgi does not appear in the URL. A preferable way is to use the ScriptAlias and SetHandler configuration directives to route requests to the FastCGI s
issue tracker Install guide Other languages : español | Japan 日本語 | chinese 简体中文 | italiano | français | Serbo-Croatian Summary Install .. on MacOS X Development Production LightTPD .. with FastCGI Apache http://webpy.org/install .. with CGI .. with CGI using .htaccess .. with FastCGI .. with SCGI https://forum.alwaysdata.com/viewtopic.php?id=3879 .. with mod_python .. with mod_wsgi .. with mod_rewrite Install To install web.py, download: http://webpy.org/static/web.py-0.38.tar.gz or the get the latest dev version: https://github.com/webpy/webpy/tarball/master extract it and copy the web folder into a directory where your application is. Or, to make it accessible to all applications, run: python setup.py install Note: on some unix like systems you error no may need to switch to root or run: python setup.py install see recommended setup. Another option is to use Easy Install. Once Easy Install is properly setup: easy_install web.py Or PIP pip install web.py MacOS X To install web.py on mac os x. Web.py 0.1 only... Development web.py comes with a built-in webserver. Learn how to write an application by following the tutorial. When you have an application written, put error no module your code into code.py and start the server like this: python code.py Open your browser and go to http://localhost:8080/ to view the page. To specify another port, use python code.py 1234. Production The web server that gets started when you run a web.py program is nice, but for popular sites you're going to want something a little more serious. web.py implements WSGI and runs with everything that is compatible to it. WSGI is a common API between web servers and applications, analogous to Java's Servlet Interface. To run web.py with CGI, FastCGI or SCGI you will need to install flup (download here), which provides WSGI interfaces for those APIs. For all the CGI variants, add this to the top of your code.py: #!/usr/bin/env python And run chmod +x code.py to make it executable. LightTPD .. with FastCGI FastCGI with lighttpd is the recommended way of using web.py in production. reddit.com handles millions of hits this way. Your lighttpd config can be something like: server.modules = ("mod_fastcgi", "mod_rewrite") server.document-root = "/path/to/root/" fastcgi.server = ( "/code.py" => (( "socket" => "/tmp/fastcgi.socket", "bin-path" => "/path/to/root/code.py", "max-procs" => 1 )) ) url.rewrite-once = ( "^/favicon.ico$" => "/static/favicon.ico", "^/static/(.*)$" => "/static/$1", "^/(.*)$" => "/code.py/$1" ) With some versions of lighttpd, it is important
Pages: 1 #1 01-08-2013 14:34:01 lordluke80 Membre From: Milan Registered: 25-04-2012 Posts: 23 [SOLVED] django app delpy on FastCGI - import error Hi everyone. I'm trying to deply a simple app through FastCGI but i have this error:WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI! WSGIServer: missing FastCGI param SERVER_NAME required by WSGI! WSGIServer: missing FastCGI param SERVER_PORT required by WSGI! WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI! Internal Server Error: / Traceback (most recent call last): File "/usr/local/alwaysdata/python/django/1.5.1/django/core/handlers/base.py", line 103, in get_response resolver_match = resolver.resolve(request.path_info) File "/usr/local/alwaysdata/python/django/1.5.1/django/core/urlresolvers.py", line 319, in resolve for pattern in self.url_patterns: File "/usr/local/alwaysdata/python/django/1.5.1/django/core/urlresolvers.py", line 347, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/alwaysdata/python/django/1.5.1/django/core/urlresolvers.py", line 342, in urlconf_module self._urlconf_module = import_module(self.urlconf_name) File "/usr/local/alwaysdata/python/django/1.5.1/django/utils/importlib.py", line 35, in import_module __import__(name) File "/nfs/http11/newsletter/www/newsletter/simple_newsletter_project/urls.py", line 9, in