Re: Custom Commands?
Sorry about that, here is the tuple in question:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'polls',
)
I have the x.py command working now. As I placed the management/commands in the polls app as opposed the mysite "thing". So that I am calling things what they need to be called, the outer folder (the one that the Django docs say I can rename) is that the project directory? Or is the inner directory of the same name, which I have been thinking of as a "base app" the project directory? The "base app" is not in the INSTALLED_APPS tuple, but you are saying that I CAN include it there and have the management/commands stuff in there if I think it makes organizational sense? Does making the "base app" an INSTALLED_APP bring with it any security or performance issues I should be aware of?INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'polls',
)
On Thu, Apr 11, 2013 at 5:14 AM, Tom Evans <tevans.uk@googlemail.com> wrote:
On Thu, Apr 11, 2013 at 12:41 PM, Mark Lybrand <mlybrand@gmail.com> wrote:Yes, management commands that relate to your poll objects should
> So, you have a management/commands structure in each app of your project and
> not in the main "app" (or whatever that thing is called). Here is the
> structure of my whole project thus far (I had just shown the part that I
> thought was important).
probably belong in the poll app. Management commands that use the
functionality of two or more apps, make your own choice about where
they live.
Usually, one app may add functionality to another app - the management
command that uses both apps should go in the former, since the latter
may be used by itself, and in that scenario the management command
would not make sense.
Not seeing your settings.py or anything called 'app', hard to comment on!
> As you can see I already had an app and the app is
> included in the INSTALLED_APPS of settings.py:
>
> │ manage.py
>Is mysite an app? In my projects, 'mysite' is the project directory.
> │
> ├───mysite
> │ │ settings.py
> │ │ settings.pyc
> │ │ urls.py
> │ │ urls.pyc
> │ │ wsgi.py
> │ │ wsgi.pyc
> │ │ __init__.py
> │ │ __init__.pyc
> │ │
> │ └───management
> │ │ __init__.py
> │ │
> │ └───commands
> │ x.py
> │ __init__.py
It holds the things that apply across the entire project, like the top
level urls.py, settings.py and so on, doesn't provide any models and
doesn't hook in to the admin site, so in my projects it's not an app -
meaning it's not a package listed in INSTALLED_APPS.
The only reason to have it as an app would be so that your management
commands are discoverable. In general, my sites have a main app,
separate from the project directory, and this is where I place my
management commands that apply just to this project, and management
commands that apply to all uses of an app live in that app.
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
Mark :)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home