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
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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.