Creating a Project In Django

Search for a command to run...

No comments yet. Be the first to comment.
This is a basic Django tutorial in which we will create an Authentication App, from scratch in Django 2.0 and Learn the Fundamental concepts of Django Framework.
Now that our environment -- a "project" -- is set up, we're set to start doing work. In this section, we will learn what is an App in Django and we will create an account App to handle the user signup feature. So let's get started. What is App? An Ap...
You've done it. I've done it. We've all done it.

Your AI Agent Has Amnesia. ByteRover Fixes It — Without Vectors Let's see how to built a customer support agent that remembers everything — using plain markdown files, BM25 search, zero embeddings, a

My GenAI cohort kicked off today, and what a first day! Right away we were reminded that AI isn’t magic — at its core, models like Generative Pretrained Transformers (GPT) are doing one simple thing:

Hello Folks👋, I Recently got Graduated🎓 in 2020, yep in the Pandemic. We all hit very hard by this Corona Pandemic and we all got stuck at home for very long. We all realize the Importance of Socializing, Fitness (Physically as well Mentally), Diet...

So after learning the basic commands of git in our previous section, let's see Git in action. If you already have a project to track your files then you can skip this section and if not then continue. Initializing a Repository from Non-existing Dire...

So far we learn and understand what exactly Django is and how it works. Now let us build a cool app (project) in Django. We will learn, Django by building a Social Media app. So let's get started with the tutorial.
Throughout this tutorial, we'll walk you through the creation of a basic Social Media application.
It'll consist of 4 parts:
We'll assume you have Django installed already. You can tell Django is installed and which version by running the following command in a shell prompt.
python -m django --version
py -m django --version
If Django is installed, you should see the version of your installation. If it isn't, you'll get an error telling "No module named django".
Whether you are on Windows or Linux, From the command line, cd into a directory where you'd like to store your code, then run the following command:
django-admin startproject social
This will create a social directory in your current directory. This directory will consist of an initial setup to build the website -- a collection of settings for an instance of Django, including database configuration, Django-specific options, and application-specific settings.
Let's look at what startproject created:
social/
manage.py
social/
__init__.py
settings.py
urls.py
asgi.py
wsgi.py
These files are:
social/ root directory is a container for your project. Its name doesn't matter to Django; you can rename it to anything you like.manage.py: A command-line utility that lets you interact with this Django project in various ways.social/ directory is the actual Python package for your project. Its name is the Python package name you'll need to use to import anything inside it (e.g. myblog.urls).social/__init__.py: An empty file that tells Python that this directory should be considered a Python package.social/settings.py: Settings/configuration for this Django project. Django settings will tell you all about how settings work.**social/urls.py**: The URL declarations for this Django project; a "table of contents" of your Django-powered site.social/asgi.py: An entry-point for ASGI-compatible web servers to serve your project. social/wsgi.py: An entry-point for WSGI-compatible web servers to serve your project. Let's verify your Django project works. Change into the outer social directory, if you haven't already, and run the following commands:
python manage.py runserver
You'll see the following output on the command line:
Performing system checks...
System check identified no issues (0 silenced).
You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
February 03, 2020 - 15:50:53
Django version 2.1.7, using settings 'social.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Ignore the warning about unapplied database migrations for now; we'll deal with the database shortly.
Now that the server's running, visit http://127.0.0.1:8000/ with your Web browser. You'll see a "Congratulations!" page, with a rocket taking off. It worked!