Closed SilverTab closed 12 years ago
Hi Jean-Nicolas !
If it helps at all, this is my current directory structure:
This always helps! The number of ways to do this means that it's sometimes hard to infer - thanks :)
I wasn't so sure what my .dir-locals.el file should look like
So: the value of :settings corresponds to the value that you would pass to manage.py:
$ python manage.py help
{...snips...} --settings=SETTINGS The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used. {...snips...}
so I wouldn't be surprised if both "local" and "local/settings" didn't work
In fact I'd be a little surprised if
$ python manage.py runserver_plus
worked without an init.py in the settings directory - something is happening here that I don't quite understand :S
If you can tar up something that reproduces the problem and specify what Django version is running I'm more than happy to take a look though :)
Love regards etc
David Miller
Love regards etc
David Miller http://www.deadpansincerity.com 07854 880 883
Success!
Setting it to "settings" did the trick! (about that missing init.py file in the settings directory, it was really just my directory listing that was incomplete in my initial post, there is indeed an init.py file in that directory!)
Thanks a lot for the help!
Setting it to "settings" did the trick!
Great!
Probably a good idea for me to take a look at the documentation for this and see if I can make it more explicit
Thanks a lot for the help!
You're welcome
P.S. Dear Github - does this work? (Because it really should)
closes #32
Love regards etc
David Miller http://www.deadpansincerity.com 07854 880 883
Argh... I may have been to quick at closing the issue... it seems the the django shell is working just fine (I am invoking it with [Cc-Cp s], and all my models are loaded properly (so shell_plus works) but for some reason, retrieving anything from the database is not working.
i.e. Foo.objects.get(pk=1)
is not working and is giving me the following error:
DatabaseError: no such table: foos_foo
This is with an sqlite3 local database. Doing the exact same thing in the terminal works just fine and retrieves the object. I have no idea how that is possible!
BTW if you want me to write this somewhere else as to not clutter your project's issue page, don't hesitate to let me know!
J-N
Hmmm... first thing I would check is how you're specifying the path to the sqlite database in your settings.
IIRC if you have a relative path there then it's dependant on the value of os.getcwd() (I'll be honest, I haven't actually tested this :)
Manage commands get run from the Emacs current directory (where the file is) with absolute paths to the relevant Python and manage.py...
If you could try that (e.g. wrap the path in os.path invocations to get an absolute path) & then if that doesn't work post relevant settings that would be neat!
Meanwhile - although you're more than welcome to post here if you prefer, there is in fact a (very low traffic) google group [1] which you're more than welcome to use for any longer discussions or even just casual Emacs/python etc related kerfuffle
FWIW I just recreated this while fixing another bug - the following works here:
# Django settings for ponytester project.
import os
ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': os.path.join(ROOT, 'ponytest.db'), # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
For some reason, every time I try to run the shell (or to start the server) I get an "Unknown command: 'shell_plus'" or "Unknown command: 'server_plus'" error
django-extensions is installed and running
python manage.py shell_plus
in a terminal works just fine...After messing around a lot, I think the problem could be that pony-mode cannot find my settings file. I'm a bit confused as to what I should put in my .dir-locals.el file for the "settings" key.
If it helps at all, this is my current directory structure:
as you can see, my local settings file is in a directory, so I wasn't so sure what my .dir-locals.el file should look like. This is what I have right now:
I also tried changing :settings to "settings/local" but, no luck... Any help would be appreciated.