Skip to content

mitchtabian/CreateDjangoProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

CreateDjangoProject

How to start a Django project from scratch

Starting a new Django Project (Windows)

  1. Installing Python
    1. Download the version of Python you need here
    2. After Python is finished installing, make sure the path to the Scripts folder is added to Environment Variables PATH. It should do it automatically but it's better to double check. My path looks like this: 'F:\Python\Python35\Scripts'
    3. Check to see if Python installed correctly by opening a command prompt and typing: "python3 –version". You should see something like this:
      Python 3.6.1
  2. Update Pip
    1. Pip should be installed already but you'll have to update it. Open a command prompt and type:
      python -m pip install -U pip setuptools
  3. Install Virtual Environment
    1. You need to install a virtual environment tool for developing. In the command prompt type:
      pip install virtualenv
  4. Install Django Web Framework
    1. For documentation check out "https://docs.djangoproject.com". To install Django type:
      pip install django==1.10
      Use 1.10 since thats what I'm using and it will be a long-standing version.
  5. Create Virual Environment
    1. Navigate to the directory you want to keep your django projects. I just use: "F:\PyCharmProjects" because the IDE I use to write code is PyCharm. There are many code editors but PyCharm has a free version so I use that.
      To create a Virtual Environment navigate to the directory where you want your project and open a command prompt there.Type:
      virtualenv {project_name}
      Obviously without the '<' and '>'.
  6. Start the Virtual Environment
    1. To activate the virtual environement first navigate into it by typing:
      cd project_name
      Then start the Virtual Environment by typing:
      Scripts/activate
      You'll see the name of it encapsulated in brackets in the command prompt if you did it correctly. Now we have an isolated environment to develop in.
  7. Create the django project
    1. To create a new Django Project type:
      django-admin startproject django_project
      It might take 30 seconds or so to start the project. Once it's done open the directory in PyCharm or whatever code editor your using.
  8. Run the Server
    1. navigate into the 'django_project' directory by typing
      cd django_project

      Once inside type:
      python manage.py runserver
      Your server will start. Now open a web browser and type: "http://127.0.0.1:8000/" in the URL bar. If it's working it will say: "It worked! Congratulations on your direct Django-powered page." in the web browser.

About

How to start a Django project from scratch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published