Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Hyphens in Django app/project names? [RSS Feed]

#1 Jan. 15, 2011 02:48:29

Victor H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Hyphens in Django app/project names?


heya,

I'm just wondering whether you are allowed to use hyphens in Django
app/project names?

When I try to create either an app or a project with hyphens in the name, I
get an error:

Error: 'django-library' is not a valid app name. Please use only numbers,
letters and underscores.

However, I know of several other apps which seem to have hyphens in their
name.https://bitbucket.org/ubernostrum/django-registrationhttps://github.com/django-extensions/django-extensionshttps://github.com/jezdez/django-staticfilesIn fact, if you look at Django Pluggables (did they get renamed to Django
Packages?), every mult-word app seems to use hyphens:http://djangoplugables.com/Did they just create the Django directory structure by hand, instead of
using manage.py? Is it considered bad practice to use hyphens in names? Are
they any good standards documents on Django app/project naming conventions?
(I could only find an outdated one athttp://homepage.mac.com/s_lott/iblog/architecture/C1597055042/E20070622152523/index.html).

Cheers,
Victor

--
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+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 15, 2011 04:27:45

Russell K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Hyphens in Django app/project names?


On Sat, Jan 15, 2011 at 10:48 AM, Victor Hooi <victorh...@gmail.com> wrote:
> heya,
> I'm just wondering whether you are allowed to use hyphens in Django
> app/project names?
> When I try to create either an app or a project with hyphens in the name, I
> get an error:
>
> Error: 'django-library' is not a valid app name. Please use only numbers,
> letters and underscores.
>
> However, I know of several other apps which seem to have hyphens in their
> name.
>https://bitbucket.org/ubernostrum/django-registration>https://github.com/django-extensions/django-extensions>https://github.com/jezdez/django-staticfilesYou need to differentiate between the name of the *project* and the
name of the *module*.

Taking django-regsitration as an example -- the *project* is named
'django-registration'. When you install that project into your
PYTHONPATH, it is installed as the *module* named 'registration'.

A hyphen isn't legal when used in a package name -- hence the
restriction in startapp. startapp creates a module that needs to be
imported, so it needs to restrict to legal Python module names.
However, when you distribute your app as a packaged Python module, you
can wrap it in whatever package name you want -- and in this context,
hyphens are legal.

The "django-" prefix is fairly common, allowing you to differentiate
'django-registration' from other web framework registration modules.
However, it isn't a mandated standard or anything like that.

> In fact, if you look at Django Pluggables (did they get renamed to Django
> Packages?),

Django Packages and Django Pluggables are different projects. I'm not
sure what happened to Django Pluggables.

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+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 18, 2011 00:43:03

Victor H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Hyphens in Django app/project names?


Russ,

Aha, excellent, thanks for clearing that up =).

I can see you point - django-registration has a module called
"registration", django-extensions has a module called "django_extensions",
and django-staticfiles has one called "staticfiles". So it seems like I
either go for a single-word module name, or replace hyphens with
underscores.

Is there any recommendation from the Django team? Is sing underscores as
faux-hyphens considered bad practice?

Cheers,
Victor

--
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+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Jan. 23, 2011 11:42:49

Russell K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Hyphens in Django app/project names?


On Tue, Jan 18, 2011 at 8:42 AM, Victor Hooi <victorh...@gmail.com> wrote:
> Russ,
> Aha, excellent, thanks for clearing that up =).
> I can see you point - django-registration has a module called
> "registration", django-extensions has a module called "django_extensions",
> and django-staticfiles has one called "staticfiles". So it seems like I
> either go for a single-word module name, or replace hyphens with
> underscores.
> Is there any recommendation from the Django team? Is sing underscores as
> faux-hyphens considered bad practice?

The only recommendation I would make is that the name you choose is
essentially the interface to your api, so make it easy to use.

django_foobar is accurate, but a PITA if you have to type it every
time you import/use the app, especially if foobar isn't likely to be
inaccurate in the circumstances.

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+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Hyphens in Django app/project names? [RSS Feed]

Board footer

Moderator control

Enjoy the 23rd of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support