Portfolio-Blog Website
My personal Portfolio_Blog using Django!
After completing a course on youtube by Dennis IVY I started doing practicals on Django. After being comfortable, I made my first project in Django Framework. My personal Portfolio_Blog which displays all my work experience, my projects, education, skills, etc
How to Start
I will be using the following for this project:
- Django
- Python
- Pip
- Operating System-Windows 10
Set Up Your Development Environment
Step:1 Install Python 3
Step 2: Create your project
Whenever you are starting a new web development project, it’s a good idea to first set up your development environment. Create a new directory for your project to live in, and cd
into it:
$ mkdir mk-portfolio
$ cd mk-portfolio
Step 3: Install Virtual Environment
Now we will use a module named virtualenv to create isolated virtual environments. But first, let’s install this module by the following command,
To verify a successful installation run this
$ pip install virtualen
or by using conda to create a virtualenv:
$ conda create --name portf_env
virtualenv --version
Step 4: Create your Virtual Environment
Once you're inside the main directory, it’s a good idea to create a virtual environment to manage dependencies. There are many different ways to set up virtual environments, but here you’re going to use venv
:
$ virtualenv myenv
Step 5: Activate your virtual env :
This command will create a folder venv
in your working directory. Inside this directory, you’ll find several files including a copy of the Python standard library. Later, when you install new dependencies, they will also be stored in this directory. Next, you need to activate the virtual environment by running the following command.
C:\> myenv\Scripts\activate.bat
or
activate portf_env
You’ll know that your virtual environment has been activated because your console prompt in the terminal will change. It should look something like this:
(venv) $
or
(portf_env) $
Step 6: Install Django on your virtual env :
If you have already installed Django, you can skip this section and jump straight to the Setting up the project section. To Install Django on your virtual environment run the below command
(venv) $ pip install Django
or
(portf-env) $ pip install Django
it will install the latest Django version, otherwise use pip install Django==version
This will install the latest version of Django in our virtual environment. To know more about Django installation read: How To Install Django
Note — You must install a version of Django greater than 2.0
Step 7: Create your Django app
Now run the following command in your shell to create a Django project.
django-admin startproject myproject
This will generate a project structure with several directories and python scripts.
├── myproject
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ ├── wsgi.py
├── manage.py
Step 9: Create your portfolio app
Navigate into the outer directory where manage.py
the script exists and run the below command.
cd mysite
python manage.py startapp my-personal-portfolio
These will create an app named blog in our project.
├── db.sqlite3 ├── myproject │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ ├── wsgi.py ├── manage.py └── my-personal-portfolio ├── __init__.py ├── admin.py ├── apps.py ├── migrations │ └── __init__.py ├── models.py ├── tests.py └── views.py
Now we need to inform Django that a new application has been created, open your settings.py
file and scroll to the installed apps section, which should have some already installed apps.
Now add the newly created app blog at the bottom and save it.ù
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'my-personal-portfolio'
]
Step 10: Test your server
Next, make migrations.
python manage.py migrate
This will apply all the unapplied migrations on the SQLite database which comes along with the Django installation. Let’s test our configurations by running the Django’s built-in development server.
python manage.py runserver
Open your browser and go to this address http://127.0.0.1:8000/
if everything went well you should see this page.
Step:11 Add your code
Customize your website as you need.
You can visit my website: https://www.ayoubberdeddouch.com
If any queries ping me or comment down. I will be grateful to help you out.
or reach me at Contact Form
(To be continued how I host it on cloud )
Technology : Django,Python,Bootstrap,HTML5,CSS3, GCP, Apache2, Namecheap.