Ask Your Question
0

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

asked 2013-09-09 05:44:43 -0500

ironsand gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-09-23 15:55:43 -0500

Evgeny gravatar image

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-09-09 05:44:43 -0500

Seen: 5,621 times

Last updated: Sep 23 '13