Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problems configuring and running uWSGI
#1
Im trying to follow a tutorial to deploy a simple blog with Django and running into some problems with uwsgi.
So far I have done the following (as per the tutorial instructions):

Moved the contents of settings.py to base.py 
Created local.py and pro.py files in a new settings folder for local and production environments 
Installed PSQL and created a user and db Installed WSGI

I have then run uwsgi with this command

 
uwsgi --module=codego.wsgi:application --  env=DJANGO_SETTINGS_MODULE=codego.settings.pro --   http=127.0.0.1:80 --   virtualenv=/Users/david/documents/projects/django/codego   /venv/ --thunder-lock
I am then able to open my django site locally where it loads with no css

I then created the following uwsgi.ini file in a directory labeled ‘config’ in the main project folder


[uwsgi]
#variables
projectname = codego
base = /Users/david/documents/projects/django/codego/
 #configuration
master = true
virtualenv =     /Users/david/documents/projects/django/codego/venv/
pythonpath = %(base)
chdir = %(base)
env = DJANGO_SETTINGS_MODULE=%   (codego).settings.pro
module = codego.wsgi:application
socket = /tmp/%(codego).sock
finally I run this command


uwsgi –ini config/uwsgi.ini
and then I get the error:


ImportError: No module named 'codego.wsgi'

unable to load app 0 (mountpoint='') (callable not found     or import error)
and this is the full output:


[uWSGI] getting INI configuration from config/uwsgi.ini
*** Starting uWSGI 2.0.13.1 (64bit) on [Wed Sep 28    19:40:26 2016] ***
compiled with version: 4.2.1 Compatible Apple LLVM   7.0.2 (clang-700.1.81) on 17 September 2016 14:57:57
os: Darwin-14.5.0 Darwin Kernel Version 14.5.0: Mon  Aug 29 21:14:16 PDT 2016; root:xnu-  2782.50.6~1/RELEASE_X86_64
nodename: Davids-MacBook-Air.local
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory:   /Users/david/Documents/projects/django/codego/codego
detected binary path:   /Users/david/Documents/projects/django/codego/venv/bin/   uwsgi
!!! no internal routing support, rebuild with pcre support  !!!
chdir() to  /Users/david/documents/projects/django/codego/
your processes number limit is 709
your memory page size is 4096 bytes
detected max file descriptor number: 256
lock engine: OSX spinlocks
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/%    (codego).sock fd 3
Python version: 3.5.1 (default, Dec  7 2015, 21:59:08)     [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)]
Set PythonHome to     /Users/david/documents/projects/django/codego/venv/
*** Python threads support is disabled. You can enable it    with --enable-threads ***
Python main interpreter initialized at 0x7f96a9d00c00
your server socket listen backlog is limited to 100   connections
your mercy for graceful operations on workers is 60  seconds
mapped 145520 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
added /Users/david/documents/projects/django/codego/    to pythonpath.
ImportError: No module named 'codego.wsgi'
unable to load app 0 (mountpoint='') (callable not found    or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 2935)
spawned uWSGI worker 1 (pid: 2936, cores: 1)
it seems that there’s a problem with the wsgi file being loaded but its in the right place. This is the path to the file also:


  /Users/david/Documents/projects/django/codego/codego/codego/wsgi.py
and this is the contents of it:


import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE",   "codego.settings")

application = get_wsgi_application()
also if I try to run wigs.py I get a long output of errors, this is a sample


File "wsgi.py", line 16, in <module>
    application = get_wsgi_application()
  File   "/Users/david/Documents/projects/django/codego/venv/lib/ python3.5/site-packages/django/core/wsgi.py", line 13, in    get_wsgi_application
    django.setup(set_prefix=False)
and


return _bootstrap._gcd_import(name[level:], package,   level)
  File "<frozen importlib._bootstrap>", line 986, in  _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in    _find_and_load

ImportError: No module named 'codego'
what am I doing wrong here?

thanks
Quote
#2
Hello,

Have you seen this


Larz60+
Quote
#3
Quote: /Users/david/Documents/projects/django/codego/codego/codego/wsgi.py
Why is it nested so deeply within itself? Wouldn't that mean you'd need to do something like "from codego.codego import codego"?
It's dangerous to go alone!  Take this: https://docs.python.org/3/library/index.html
Kevin Flynn is my spirit animal.
Quote
#4
hello and sorry for the lack of response here, I setup using nginx on Digital Ocean in the end, thanks for the responses though
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  location settings for Django Uwsgi Nginx Configuration for production sandyman 0 103 Sep-15-2017, 09:08 AM
Last Post: sandyman
  Django+uWsgi unable to find "application" callable rosettas 3 290 Aug-24-2017, 01:41 PM
Last Post: nilamo
  running Django app with REST chemseddineZ 2 430 Apr-07-2017, 03:18 PM
Last Post: shahpy

Forum Jump:


Users browsing this thread: 1 Guest(s)