Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82582 > unrolled thread
| Started by | Veek M <vek.m1234@gmail.com> |
|---|---|
| First post | 2014-12-16 21:31 +0630 |
| Last post | 2014-12-17 19:45 +0630 |
| Articles | 6 — 2 participants |
Back to article view | Back to comp.lang.python
uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-16 21:31 +0630
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Chris Warrick <kwpolska@gmail.com> - 2014-12-16 17:20 +0100
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-17 08:01 +0630
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-17 08:28 +0630
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-17 09:57 +0630
Re: uWSGI, nGinx, and python on Wheezy: how do you configure it? Veek M <vek.m1234@gmail.com> - 2014-12-17 19:45 +0630
| From | Veek M <vek.m1234@gmail.com> |
|---|---|
| Date | 2014-12-16 21:31 +0630 |
| Subject | uWSGI, nGinx, and python on Wheezy: how do you configure it? |
| Message-ID | <m6pl11$b7$1@dont-email.me> |
Has anyone got the thing to work? I want to run some python database scripts
on nginx. Because that will have a simple web-UI, i decided to go with
uWSGI. It's proving to be a massive pain.
I found a decent book for nginx and got that bit working. The query gets
sent to uWSGI but for some reason it can't find my script.
Most of the documentation on the web is utterly horrid and will take a 4
year PhD to understand. I don't undertsand the architecture of uWsgi - he's
got a bunch of modules and I don't undertsand what exactly is going on
inside it!
less /etc/nginx/sites-enabled/default
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/app/uwsgi/sockete;
uwsgi_param UWSGI_PYHOME /usr/share/nginx/cgi;
uwsgi_param UWSGI_CHDIR /usr/share/nginx;
uwsgi_param UWSGI_SCRIPT index; #NOT SURE WHAT THIS DOES?
less /etc/uwsgi/apps-enabled/uwsgi.ini
[uwsgi]
plugins=python
socket=/tmp/uwsgi.socket
pythonpath=/usr/share/nginx/cgi/
Tue Dec 16 20:43:21 2014 - Python main interpreter initialized at 0x95cde0
Tue Dec 16 20:43:21 2014 - your server socket listen backlog is limited to
100 connections
Tue Dec 16 20:43:21 2014 - *** Operational MODE: preforking ***
Tue Dec 16 20:43:21 2014 - added /usr/share/nginx/cgi/ to pythonpath.
Tue Dec 16 20:43:21 2014 - *** no app loaded. going in full dynamic mode ***
Tue Dec 16 20:43:21 2014 - *** uWSGI is running in multiple interpreter mode
***
Tue Dec 16 20:43:21 2014 - spawned uWSGI master process (pid: 18792)
Tue Dec 16 20:43:21 2014 - spawned uWSGI worker 1 (pid: 18818, cores: 1)
Tue Dec 16 20:43:21 2014 - spawned uWSGI worker 2 (pid: 18819, cores: 1)
::1 - - [16/Dec/2014:21:08:03 +0530] "GET /foo.py HTTP/1.1" 502 172 "-"
"Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0"
[toc] | [next] | [standalone]
| From | Chris Warrick <kwpolska@gmail.com> |
|---|---|
| Date | 2014-12-16 17:20 +0100 |
| Message-ID | <mailman.16999.1418746849.18130.python-list@python.org> |
| In reply to | #82582 |
On Tue, Dec 16, 2014 at 4:01 PM, Veek M <vek.m1234@gmail.com> wrote:
> Has anyone got the thing to work? I want to run some python database scripts
> on nginx. Because that will have a simple web-UI, i decided to go with
> uWSGI. It's proving to be a massive pain.
>
> I found a decent book for nginx and got that bit working. The query gets
> sent to uWSGI but for some reason it can't find my script.
>
> Most of the documentation on the web is utterly horrid and will take a 4
> year PhD to understand. I don't undertsand the architecture of uWsgi - he's
> got a bunch of modules and I don't undertsand what exactly is going on
> inside it!
>
> less /etc/nginx/sites-enabled/default
> location / {
> include uwsgi_params;
> uwsgi_pass unix:/run/uwsgi/app/uwsgi/sockete;
> uwsgi_param UWSGI_PYHOME /usr/share/nginx/cgi;
> uwsgi_param UWSGI_CHDIR /usr/share/nginx;
> uwsgi_param UWSGI_SCRIPT index; #NOT SURE WHAT THIS DOES?
>
>
> less /etc/uwsgi/apps-enabled/uwsgi.ini
> [uwsgi]
> plugins=python
> socket=/tmp/uwsgi.socket
> pythonpath=/usr/share/nginx/cgi/
>
> Tue Dec 16 20:43:21 2014 - Python main interpreter initialized at 0x95cde0
> Tue Dec 16 20:43:21 2014 - your server socket listen backlog is limited to
> 100 connections
> Tue Dec 16 20:43:21 2014 - *** Operational MODE: preforking ***
> Tue Dec 16 20:43:21 2014 - added /usr/share/nginx/cgi/ to pythonpath.
> Tue Dec 16 20:43:21 2014 - *** no app loaded. going in full dynamic mode ***
> Tue Dec 16 20:43:21 2014 - *** uWSGI is running in multiple interpreter mode
> ***
> Tue Dec 16 20:43:21 2014 - spawned uWSGI master process (pid: 18792)
> Tue Dec 16 20:43:21 2014 - spawned uWSGI worker 1 (pid: 18818, cores: 1)
> Tue Dec 16 20:43:21 2014 - spawned uWSGI worker 2 (pid: 18819, cores: 1)
>
>
> ::1 - - [16/Dec/2014:21:08:03 +0530] "GET /foo.py HTTP/1.1" 502 172 "-"
> "Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0"
> --
> https://mail.python.org/mailman/listinfo/python-list
This is NOT how uwsgi works! You cannot use plain .py files with it,
and for good reason — CGI should be long dead.
What you need to do is, you must write a webapp — in Flask, for
example. Then you must craft an .ini file that mentions this.
With the http://flask.pocoo.org/ demo as /var/flask/hello.py
(copy-pasting from my working site):
--- nginx config --
location {
include uwsgi_params;
uwsgi_pass 127.0.0.1:3031;
}
--- /etc/uwsgi/apps-enabled/hello.ini ---
[uwsgi]
emperor = true
socket = 127.0.0.1:3031
chdir = /var/flask/
master = true
threads = 5
module = %n
callable = app
plugins = python
uid = http
gid = http
processes = 3
--- If /var/flask is a virtualenv, add:
binary-path = /var/flask/bin/uwsgi
virtualenv = /var/flask
--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16
[toc] | [prev] | [next] | [standalone]
| From | Veek M <vek.m1234@gmail.com> |
|---|---|
| Date | 2014-12-17 08:01 +0630 |
| Message-ID | <m6qpto$htk$1@dont-email.me> |
| In reply to | #82583 |
Chris Warrick wrote: > This is NOT how uwsgi works! You cannot use plain .py files with it, > and for good reason ? CGI should be long dead. > > What you need to do is, you must write a webapp ? in Flask, for > example. Then you must craft an .ini file that mentions this. **Hi Chris, Could you suggest some specific document (URL) that illustrates the working principle behind uWSGI?** I only know CGI so.. i'm beginning to think uWSGI works with single python files as in, with CGI, the user can pretty much pick any .py: foo.py, bar.py, imaginary.py merely by editing his URL request. With uWSGI you generally start one .py file and use that to access the larger framework/library?
[toc] | [prev] | [next] | [standalone]
| From | Veek M <vek.m1234@gmail.com> |
|---|---|
| Date | 2014-12-17 08:28 +0630 |
| Message-ID | <m6qrfu$dtf$1@dont-email.me> |
| In reply to | #82583 |
Just to be very very clear about this:
1. I have never worked seriously with Javascript, frameworks, django, flask
etc.
2. I can write CGI on Apache.
3. I have never worked with nginx untill 2 days ago.
4. All this started because I wanted to mess with SQL/CSS/HTML5.
5. Some frigging! *moron* on IRC-freenode told me to look at the website via
google..
There is a long list of links that serves as a TOC and there's no
'Architecture' or 'What is uWSGI?' - it starts with a cookbook solution,
installing, configuration, FIFO, Socket.. but there's nothin on what the app
is!
I've read PEP 333 and PEP 3333 and googled even more cookbook solutions..
and the wikipedia has no info barring it's an appserver
I know what a webserver is.. reverse proxy too.. but appserver as per
wikipedia is difficult for me to understand..
Quickstart for Python/WSGI applications
Quickstart for perl/PSGI applications
Quickstart for ruby/Rack applications
Snippets
Getting uWSGI
Installing uWSGI
The uWSGI build system
Managing the uWSGI server
Supported languages and platforms
Supported Platforms/Systems
Web server integration
Frequently Asked Questions (FAQ)
Things to know (best practices and ?issues?) READ IT !!!
Configuring uWSGI
Fallback configuration
Configuration logic
uWSGI Options
Defining new options for your instances
How uWSGI parses config files
uwsgi protocol magic variables
The uwsgi Protocol
Managing external daemons/services
The Master FIFO
Socket activation with inetd/xinetd
Running uWSGI via Upstart
Systemd
Running uWSGI instances with Circus
Embedding an application in uWSGI
Logging
Formatting uWSGI requests logs
Log encoders
Hooks
Glossary
uWSGI third party plugins
The uWSGI Caching Cookbook
Setting up Django and your web server with uWSGI and nginx
Running uWSGI on Dreamhost shared hosting
Running python webapps on Heroku with uWSGI
Running Ruby/Rack webapps on Heroku with uWSGI
Reliably use FUSE filesystems for uWSGI vassals (with Linux)
Build a dynamic proxy using RPC and internal routing
Setting up Graphite on Ubuntu using the Metrics subsystem
[toc] | [prev] | [next] | [standalone]
| From | Veek M <vek.m1234@gmail.com> |
|---|---|
| Date | 2014-12-17 09:57 +0630 |
| Message-ID | <m6r0n3$vf$1@dont-email.me> |
| In reply to | #82583 |
http://discuss.joelonsoftware.com/default.asp?joel.3.219431.12
[toc] | [prev] | [next] | [standalone]
| From | Veek M <vek.m1234@gmail.com> |
|---|---|
| Date | 2014-12-17 19:45 +0630 |
| Message-ID | <m6s35j$n9m$1@dont-email.me> |
| In reply to | #82582 |
Dumped uwsgi - the documentation is utterly ridculous!! Switched to 'Bottle' - very nice, intutive and clean - tutorial+documentation is excellent and i got 'hello world' up and running in like 10-15 minutes vs the 2 days intermittent it took to scroll through the crap that is uwsgi-server. It's got a built in web-server, so no need to mess with nginx. http://bottlepy.org/docs/dev/index.html I think i'll like Flask too - there's a book: "Flask Web Development: Developing Web Applications with Python" Seriously though, it takes a dev about 15 minutes to scrawl out a line- diagram, scan it, and upload, explaining WTH is going on with his whole project - i'll take a 10 MB GIF anyday, vs wasting 1 day flat just staring in shock at 'Greenlets' and uwsig protocol and thw WSGI spec and the uWSGI server.. here's a quote: "Loop engines (implement events and concurrency, components can be run in preforking, threaded, asynchronous/evented and green thread/coroutine modes. Various technologies are supported, including uGreen, Greenlet, Stackless, Gevent, Coro::AnyEvent, Tornado, Goroutines and Fibers)" Somebody reading that might mistake it for the Mars landing.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web