Sunday, February 28, 2010

Re: Application Name Cannot be the Same as Site Name - is this true?

On Sun, Feb 28, 2010 at 3:33 PM, Anthony <alanthonyc@gmail.com> wrote:
> I've got my app deployed on my production server where the application
> name == site name.  (It's running fine.)
>
> I copied it down to my development machine and tried to set up the
> same thing ('python manage.py startapp [appname==sitename]'), I got
> the error message above.
>
> Did I just do something funny in my production environment that will
> bring the site down in the future?  It's running fine now, but I'm
> wondering if I should redo it for safety's sake.

The prohibition on sharing a name between appname and project name is
all about avoiding potential confusion. If you follow tutorial pattern
of putting applications inside your project directory, you can end up
with namespace confusion. For example "from foo.foo import urls" would
be valid, and so would "from foo import urls" -- but in the second
case, it would depend on your specific setup as to whether you are
referencing the application level urls or the project level urls.

While this doesn't strictly cause problems at the Python level - the
import path is clearly defined, so there isn't *technically* any
ambiguity, it's likely to be the source of more than a few headaches,
so Django catches it as a validation problem if you try to create a
potentially ambiguous application.

If you are sure you really want to have the same name for app and
project, you can - just manually create the application directory and
models.py. The name duplication isn't caught as a validation error
once the application exists -- it's just a validation error for the
`startapp` command.

Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate