all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* uwsgi and Pyramid
@ 2016-06-20 23:16 Myles English
  2016-06-21 13:23 ` 宋文武
  0 siblings, 1 reply; 2+ messages in thread
From: Myles English @ 2016-06-20 23:16 UTC (permalink / raw)
  To: help-guix

Hello,

I have defined some packages to install Pyramid (a Python web
framework) here:
https://gist.github.com/mylese/861b4765e9f533bafa2cb2b305974caa

Now I am trying to get my python app (my_app), served by uwsgi
but get the infamous "no app loaded" error from uwsgi:


$ /gnu/store/y83n9b6zl76pq1v7qb0npl7p7gd0hgd7-profile/bin/uwsgi --need-app --ini production.ini

[uWSGI] getting INI configuration from production.ini
*** Starting uWSGI 2.0.12 (64bit) on [Mon Jun 20 22:45:02 2016] ***
compiled with version: 4.9.3 on 20 June 2016 21:04:07
os: Linux-4.5.4-1-ARCH #1 SMP PREEMPT Wed May 11 22:21:28 CEST 2016
nodename: bill
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /home/myles/srv/my_app
detected binary path: /gnu/store/q3s2v62vqp288pfkswggcxjxfx1qii38-uwsgi-dev-2.0.12/bin/uwsgi
your processes number limit is 15779
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/uwsgi-my_app.sock fd 3
Python version: 3.4.3 (default, Jan  1 1970, 00:00:01)  [GCC 4.9.3]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x16487d0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145536 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. GAME OVER ***


If started with strace it gives slightly more info, it seems to
be looking for /home/myles/srv/my_app/uwsgi, but why?:


$ strace /gnu/store/y83n9b6zl76pq1v7qb0npl7p7gd0hgd7-profile/bin/uwsgi --need-app --ini production.ini

write(2, "*** Operational MODE: single pro"..., 41*** Operational MODE: single process ***
) = 41
readlink("uwsgi", 0x7ffc5954be10, 4096) = -1 ENOENT (No such file or directory)
getcwd("/home/myles/srv/my_app", 4096) = 25
lstat("/home/myles/srv/my_app/uwsgi", 0x7ffc5954bd30) = -1 ENOENT (No such file or directory)
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0
ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 3), ...}) = 0
lseek(2, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
lseek(2, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
write(2, "*** no app loaded. GAME OVER ***"..., 33*** no app loaded. GAME OVER ***
) = 33
exit_group(22)                          = ?
+++ exited with 22 +++


I have been trying the above commands from an environment started
like this:

$ guix environment --ad-hoc my_app


Where my_site.scm is:

(define-module (my-local-packages mysite)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system python)
  #:use-module (guix licenses)
  #:use-module (gnu packages python)
  #:use-module (gnu packages web)
  #:use-module (my-packages python-pyramid))

(define-public my_app
  (package
  (name "my_app")
  (version "0.0.1")
  (source
    (origin
      (method url-fetch)
      (uri (string-append
	    "file:///home/myles/srv/my_app/dist/my_app-"
	    version
	    ".tar.gz"))
      (sha256
       (base32
	"0sfyk45qgl51gi0cq5idg07zgb8qq1bn7pf9pxj8na0hyw9k6by3"))))
  (build-system python-build-system)
  (inputs
   `(("python-setuptools" ,python-setuptools)
     ("python-pyramid" ,python-pyramid)
     ("python-pyramid-mako" ,python-pyramid-mako)
     ("python-pyramid-chameleon" ,python-pyramid-chameleon)
     ("python-pygments" ,python-pygments)
     ("python-pyramid-debugtoolbar" ,python-pyramid-debugtoolbar)))
  (propagated-inputs
   `(("uwsgi" ,uwsgi "python")
     ("uwsgi" ,uwsgi "out")
     ("python" ,python)))
  (arguments
   `(#:tests? #f))  ;; ImportError: cannot import name 'my_view'
  (home-page "http://my_app.com")
  (synopsis
    "Development of my site")
  (description
    "Development of my site")
  (license expat)))


The above installs my_site from a Python tarball distribution
made like this:

my_app$ python3 setup.py sdist

In setup.py in the list "install_requires", if I add 'uwsgi' it
gives this error upon running the above "guix environment"
command:

Adding my_app 0.0.1 to easy-install.pth file

Installed /gnu/store/bc38r7nrn4p20fpvb1p9v8w9zgqplpqf-my_app-0.0.1/lib/python3.4/site-packages/my_app-0.0.1-py3.4.egg
Processing dependencies for my_app==0.0.1
Searching foAdding my_app 0.0.1 to easy-install.pth file

Installed /gnu/store/bc38r7nrn4p20fpvb1p9v8w9zgqplpqf-my_app-0.0.1/lib/python3.4/site-packages/my_app-0.0.1-py3.4.egg
Processing dependencies for my_app==0.0.1
Searching for uwsgi
Reading https://pypi.python.org/simple/uwsgi/
Download error on https://pypi.python.org/simple/uwsgi/: [Errno -2] Name or service not known -- Some packages may not be found!
Couldn't find index page for 'uwsgi' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [Errno -2] Name or service not known -- Some packages may not be found!
No local packages or download links found for uwsgi
error: Could not find suitable distribution for Requirement.parse('uwsgi')
phase `install' failed after 2.9 seconds
builder for `/gnu/store/cb22aarjscjl7bfq0lw72hirs2cx1yir-my_app-0.0.1.drv' failed with exit code 1
guix environment: error: build failed: build of `/gnu/store/cb22aarjscjl7bfq0lw72hirs2cx1yir-my_app-0.0.1.drv' failed
guix environment --ad-hoc my_app  6.83s user 0.55s system 40% cpu 18.375 total


Does anybody use uwsgi to serve a Python app successfully?  Do I
need to add 'uwsgi' to my setup.py?  Why can't uwsgi find my app?
What else can I try?

Thanks,
Myles

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: uwsgi and Pyramid
  2016-06-20 23:16 uwsgi and Pyramid Myles English
@ 2016-06-21 13:23 ` 宋文武
  0 siblings, 0 replies; 2+ messages in thread
From: 宋文武 @ 2016-06-21 13:23 UTC (permalink / raw)
  To: Myles English; +Cc: help-guix

Myles English <mylesenglish@gmail.com> writes:

> Hello,
Welcome!

>
> I have defined some packages to install Pyramid (a Python web
> framework) here:
> https://gist.github.com/mylese/861b4765e9f533bafa2cb2b305974caa
>
> Now I am trying to get my python app (my_app), served by uwsgi
> but get the infamous "no app loaded" error from uwsgi:
>
>
> $ /gnu/store/y83n9b6zl76pq1v7qb0npl7p7gd0hgd7-profile/bin/uwsgi --need-app --ini production.ini

It looks to me that this production.ini file is for paste.deploy, so you
need add 'python-pastedeploy' to the environment and pass '--ini-paste'
instead of '--ini' to uwsgi.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-21 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-20 23:16 uwsgi and Pyramid Myles English
2016-06-21 13:23 ` 宋文武

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.