Part 3 of the framework Django (here you have part 1, and part 2), after preparing a virtual environment, download Django and created the app and the super user that allow you access to the back end of the app. Today’s tras preparar el entorno virtual, descargar django y crear la aplicación y el super usuario para disponer de acceso al backend. Hoy conocemos un poco mejor los archivos que se han generado en el proyecto, que son:
This file is empty, but it’s the one that allow yo build a Python module, following the specifications of Python.
This is the config file of the web server, and, at first, you don’t need to modify anything. But you have more info here.
This is the config file for the app created, and yes, it is the file where you can configure your app depending on your needs, so, you are able to modify it. One of the main configuration data you might change is the database to use, by default with SQLite, although you can change it.
You can modify also if you are in debug mode or not, the applications included in the project (definitions are later), the idiom, …. Whenever you are creating things, you need to modify this file (it is located on probardjango).
This is the file that allow you to create routes for the app. In this case, here you can configure how to access to the backend of the app. In part 2, I show you that you can access with /admin/ and here is the place where you can change it:
The urls are everything under a project. As an example http://localhost/tarea/, and this point is where the framework allows something to happend. In the case of Django, it is based on regular expressions to map URLs with views, and you need to include also a name to be more easy.
A Django project
The first concept for learning Django is what a project is, and what an app is.
Proyecto: is the web development to be generated. It is build by apps, each one offering its own functionality.
Aplicación: One of the different parts in which a project can by splitted into.
In part 2 of Trying Django, I already created a project probardjango, where the main objective is create a list of task. I need to generate the app for Task, by using one of the functionality of manage.py:
After that, you have the app Task (tarea) ready, but you need to add it to settings.py:
La task tarea
As you can see, the app task (tarea) is a dictionary at the same level of probardjando (the project), but the content is totaly different.
Until this moment, I have written 0 lines of Python code, and everything has been created by using Django tools for web development.
Making a look at the files generated, a file __init__.py has been created on the directory task (tarea) in order to convert to a module, so this module can be imported from other files and its content.
And this is enought for today. I hope you can wait until part 4. Happy coding!