login community faq

I am trying to reset a django app with the usual command python2.6 manage.py reset *app_name*, and I get the following error:

1
2
3
4
5
6
Error: Error: *app_name* couldn't be reset. Possible reasons:
  * The database isn't running or isn't configured correctly.
  * At least one of the database tables doesn't exist.
  * The SQL was invalid.
Hint: Look at the output of 'django-admin.py sqlreset *app_name*'. That's the SQL this command wasn't able to run.
The full error: canceling statement due to statement timeout

Also if I try a full reset of the db using manage.py flush, I get the same "db not configured correctly" error. Any suggestions? I never have had this problem with the same app running local using sqlite3.

PS Not sure if this is connected to the problem or what it even means really, but for some of my table fields' id columns, the sqlall returns "DEFERRABLE INITIALLY DEFERRED".

asked Dec 07 '10 at 05:06

H_n8's gravatar image

H_n8
115

Did you try the sqlreset command as it says in the error message? If so, what was the output?

(Dec 07 '10 at 05:14) David L ♦♦ David%20L's gravatar image

It says that my DJANGO_SETTINGS_MODULE is not defined. I found a solution on a forum for this error by adding:

import os

os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'

..to the init.py function of the app, which I tried but didnt seem to have any effect.

(Dec 07 '10 at 06:34) H_n8 H_n8's gravatar image
1

Ah! Running from the command line won't set DJANGO_SETTINGS_MODULE and neither will adding it to your app.

You should be able to do this:

1
DJANGO_SETTINGS_MODULE='myapp.settings' python2.6 manage.py reset app_name
(Dec 07 '10 at 06:43) David L ♦♦ David%20L's gravatar image

Excellent, worked like a charm thanks!!

(Dec 07 '10 at 06:52) H_n8 H_n8's gravatar image

the reset command is deprecated. if you are using south, I wrote a management command for what you need: http://balzerg.blogspot.co.il/2012/09/django-app-reset-with-south.html

answered Sep 27 '12 at 12:48

Idan%20Zalzberg's gravatar image

Idan Zalzberg
1

Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited