First time here? Check out the FAQ!
0

How to remove TypeError("relative imports require the 'package' argument")
 

I'm trying to install askbot in following environment.

CentOS 6.4, Nginx, uWSGI, python 2.6.6, Django 1.4.5, without vertualenv

And start uwsgi by this command. (I renamed username and appname.)

$ sudo uwsgi --chdir=/home/username/apps/appname \
--module='appname.wsgi:application' \
--env DJANGO_SETTINGS_MODULE=appname.settings \
--master --pidfile=/tmp/project-master.pid \
--socket=127.0.0.1:44863 \
--processes=5 \
--harakiri=20 \
--limit-as=128 \
--max-requests=5000 \
--vacuum --daemonize=/var/log/uwsgi/appname.log

But I got "502 Bad Gateway" error. And this is uwsgi's log.

File "/usr/lib/python2.6/site-packages/django/utils/functional.py", line 184, in inner self._setup() File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 42, in _setup self._wrapped = Settings(settings_module) File "/usr/lib/python2.6/site-packages/django/conf/__init__.py", line 93, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python2.6/site-packages/django/utils/importlib.py", line 28, in import_module raise TypeError("relative imports require the 'package' argument") TypeError: relative imports require the 'package' argument [pid: 23728|app: 0|req: 1/2] 223.135.98.42 () {40 vars in 636 bytes} [Mon Sep 9 19:18:07 2013] GET / => generated 0 bytes in 289 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)

How should I remove this error?

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
ironsand's avatar
1
ironsand
asked 11 years ago

Comments

see more comments

1 Answer

0

It seems that the appnamemodule directory is not on your PYTHONPATH, for example - using the --pythonpath argument for the uwsgi command.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 11 years ago
link

Comments

see more comments