Is there a preferred naming convention for creating a Django app consisting of more than one word? For instance, which of the following is preferred?
my_django_app
my-django-app
mydjangoapp
Recommended solutionWhile all of them may be options 1 and 3 are syntactically allowed, is there a preference? Looking at the way Django creates the table names by combining the app name and the model name with an underscore, I'm leaning against option #1.
Thoughts?
They must be valid package names. That rules out 2 ("import my-django-app" would be a syntax error). PEP 8 says:
Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.
So, 1 and 3 are both valid, but 3 would be the recommended approach.