-
Setting up a virtual environment Made a new directory in my system. Inside that installed the python virtual environment using the command python3 -m venv . That showed some error and thus, I had to install python virtual environment like this sudo apt install python3-venv. Then I deleted the entire directory, made the directory again using mkdir . Inside this directory, I ran the command python3 -m venv , after which I activated it by source myvenv/bin/activate.
-
PIP should be up to date This we ran the command *(myvenv) ~$ python3 -m pip install --upgrade pip. Everything done here onwards will have the name of the virtual env before the prompt inside the brackets.
-
Creating the requirements file We need Django, thus we ran the following two commands: echo "Django~=2.0.6" > requirements.txt, pip install -r requirements.txt.
-
Creating the project Use command django-admin startproject mysite . (The dot at the end is important)
-
Create the database Use this command, python manage.py migrate
-
Starting the web server Use this command, python manage.py runserver
-
Create tables for the newly created model in the database Use command, python manage.py makemigrations blog (where blog is the name of the newly created model) Then you need to apply the migration file to the database, use: python manage.py migrate blog
-
Learn about DJANGO MODEL REFERENCE
-
Learn about DJANGO ADMIN
-
Learn about DJANGO DEPLOYMENT CHECKLIST. These are important for maintaining the security issue of the application.
-
Learn about URLconf.
-
Learn about DJANGO Views.
-
CSS transitions here.
-
To make changes to the website, I first push the changes to this repo. Then I go the host server webpage and pull the changes to the respective directory. Then I reload the page.
-
Learn about query sets. Here is a good question regarding chaining similar type of queries by of different properties. Also check this out about Django ORMs.
-
The static folder had problems rendering through PythonAnywhere. I had to change the default path of the /static/ url to the required directory and reload the app.
-
Notifications
You must be signed in to change notification settings - Fork 0
My first blog using django framework
amitrajitbose/my-first-blog
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
My first blog using django framework
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published