loading...

re: Django.... should I be switching around paths? VIEW POST

FULL DISCUSSION
 

I have a separate urls.py for each app! You can then use include to add all the urls.py of an app with a prefix (e.g. from an application i am working on now, 'chat/' is the prefix for the chat app)

The way to think of Django projects vs apps, is that apps are intended to be "full vertical slices" of a web application, so routing, views, models, templates, static files, and so on. It's sometimes hard to dis-entangle everything, but if you can do as much as you can, larger applications are far more manageable.

 

Ok, it messes me up when you go in between 2 files with basically the same name. The tutorial, he copied and pasted only part of a path type file or it was for urls and it messed me up. I got down the command to make a add tho

 

The extra files should go in separate directories

e.g.

apps/
    chat/
         urls.py
         models.py
         views.py
         templates/
         etc...

for a single app called "chat". does that make sense?

That said, all this really only matters if you have an aplpication / team large enough where this sort of code cleanliness is important. If you are just by yourself and just learning then you don't have to bother

Code of Conduct Report abuse