Django REST
About Lesson

In this Django REST Framework lesson we are going to learn about Django REST Framework Creating Apps, also we are going to learn that how you can create django super user.

 

 

What are Django Apps?

Django apps are used to group application functionality. If you want to work with content from a database or user interactions you have to create and configure Django apps. a project can contain as many apps as you need. for example, if you have a project for a news website , you can create an app for sport news, another app for local news, another app for about information, another app for contact information , and create additional apps as  they’re needed. there’s no hard rule to the number of apps in a project. whether to make code management simpler or delegate app work to a team, the purpose of Django apps is to group application functionality to make work easier. Django apps are normally contained in sub directories inside a project. This approach makes it easier to use Python references and naming conventions.

 

 

Now let’s create our App, first of all change directory to your Project and then use startapp command followed by the name of your app, in here we have given our app name as api.

 

 

After creating of the App, you need to add your app in the INSTALLED_APPS of settings.py file.

 

 

 

This is the Project Structure of Django App.

Django App Structure
Django App Structure

 

 

  • __init__.py .- Python file to allow app packages to be imported from other
    directories. Note __init__.py is not a Django specific file, it’s a generic file used in
    almost all Python applications.
  • migrations.- Directory that contains migrations applied to the app’s database
    definitions (i.e., model classes).
  • admin.py .- File with admin definitions for the app – such definitions are needed to
    access model class instances from the Django admin.
  • apps.py .- File with configuration parameters for the app.
  • models.py .- File with database definitions (i.e., model classes) for the app.

 

 

 

Also we are going to create a super user in Django, you can give your username and password.

 

 

 

After that you can go to this url http://localhost:8000/admin/.

Django REST Framework Creating Apps
Django REST Framework Creating Apps

 

Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found