Are we ever meant to make a totally new python module in our app?

29 views
Skip to first unread message

sas...@g.rit.edu

unread,
Jan 8, 2017, 5:32:51 PM1/8/17
to Django users
First off, I'd like to say that I am a huge noob to Django in general so I apologize if it's a dumb question, and second the title's vague because it's hard to concisely phrase this question so allow me to clarify. Throughout the tutorials we are told to make several specifically-named python modules in either our app directory or the project directory, such as "urls.py", "views.py", "models.py" etc and put our code in there, or we generate python modules via commands, like with "makemigrations". The names follow conventions, like that both the project and app url modules are named "urls.py", and need to be put in specific locations to work properly.

It is never said explicitly if the only python modules we are ever meant to make are these modules - "urls.py", "tests.py", "admin.py", etc. - and we are never meant to write a module like "foo.py" and put code in there. Is this the case? Should all python code for our Django website only be put in the modules seen in the tutorials?

Thank you for your patience

Vijay Khemlani

unread,
Jan 8, 2017, 5:54:50 PM1/8/17
to django...@googlegroups.com
Using urls.py and views.py as names is not mandatory in the app, the
"urls.py" is referenced in the urls.py of the project, and can have
any name you want, but these are convention names and useful for other
people reading your code

models.py is a tad more special because models need to be auto
discovered by Django, but it is also customizable

Other than that, you can create all the modules and packages you deem
appropiate for four needs.
> --
> 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...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/726ff65a-033f-48a6-843d-16213ac1dd95%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
Reply all
Reply to author
Forward
0 new messages