Docker for Django tutorial

Create basic static-website by using docker

A static website contains Web pages with fixed content. Each page is coded in HTML and displays the same information to every visitor. Static sites are the most basic type of website and are the easiest to create. Do not require any Web programming or database design. A static site can be built by simply creating a few HTML pages and publishing them to a Web server.

Prerequisite

Set up Environment

Start developed program

1.Install virtualenv

2.This command will be run on Window Powershell or Window Powershell run as adminstrative user not ISE, normal command prompt or doccker quickstart shell for install Django(The Web framework for perfectionists with deadlines)

PS virtualenv myenv
PS Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
(myenv) PS .\myenv\Scripts\activate.ps1
(myenv) PS pip install django

Env

3.Install MysqlClient by using python version to download example likes you use python version 3.7 (check python version python --version by you have to download Mysqlclient cp37. Click and install by using command cd to go to file cp37 directory like download then pip install filename

(myenv) PS cd .. //go to path that keep file mysqlclient
(myenv) PS pip install .\mysqlclient-1.4.2-cp37-cp37m-win_amd64.whl //if you use python version 3.7 64-bits

Windowcheck

MysqlClient

Mysqlcommand

Django

4.Create Python Django Project and Run Server

(myenv) PS django-admin startproject mysite
(myenv) PS cd mysite
(myenv) PS python manage.py runserver

Django

Django

When Restart or close command prompt

When you are already done everything, you doesn’t want to go back and do it again when you shut down, restart or close the command prompt. You open your computer and then using PowerShell and then run with Administartor mode and then run environment again. You have to go to your directory path of your file then run environment.

PS Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
PS .\myenv\Scripts\activate
(myenv) PS env.bat (env.ps1) // if you run in powershell you have to run `.\env.ps1`

Admin Run again