Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't urls.py generated with django-admin startapp mysite?

Tags:

python

django

But instead has to be created by the user.

 project
 |
 +-- settings.py
 +-- mysite
     |
     +-- views.py
     +-- apps.py
     +-- models.py
     +-- * user created urls.py file *
like image 483
Joseph Avatar asked Jul 10 '17 00:07

Joseph


People also ask

Do we already get an urls py file when we create a fresh application in Django?

When we start a new project, we are provided with a urls.py file. However, when we create apps within our project, Django doesn't provide the urls.py file for us and we are expected to create it manually.

What does Startapp do in Django?

The startapp command in Django is used to create a new app with our project. Now, we can use this command multiple times within our project to create multiple apps. By executing this command, Django automatically creates the application directory in the project directory.

What does a urls py file do in Django?

This file contains site deployment data such as server names and ports. It contains a site map of Django-approved URLs. You run this file when you get obscure 404 Not Found errors in your server logs.

What does admin py do in Django?

The admin.py file is used to display your models in the Django admin panel. You can also customize your admin panel. Hope this helps you.


1 Answers

An app doesn't need to have urls, views, or anything at all. It can also just be a collection of templates or be a middleware. Therefore these files have to be created by the user when needed.

like image 148
Claude Avatar answered Nov 14 '22 23:11

Claude