Skip to content

Instantly share code, notes, and snippets.

@SeedyROM
Created March 7, 2018 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SeedyROM/eda3616b9e383582b9f0326b1093b361 to your computer and use it in GitHub Desktop.
Save SeedyROM/eda3616b9e383582b9f0326b1093b361 to your computer and use it in GitHub Desktop.
Django startproject guide.

How to start a Django project  (PDXCG Style)

Open a terminal and go to wherever you want to create your project!

Make sure to replace $PROJECT_NAME with your own project name. Your project name should be named in snake_case and contain no captial letters.

The Steps

  1. Create a directory

    • mkdir $PROJECT_NAME
  2. Change into that directory

    • cd $PROJECT_NAME
  3. Create a virtual environment

    • python -m venv env
    • On older versions of Windows: py.exe -m venv env
  4. Activate The Environment

    • On (Mac/Linux): source env/bin/activate
    • On Windows: env/Scripts/activate
  5. Install django

    • pip install django
  6. Create your project in the currect directory

    • django-admin startproject $PROJECT_NAME .
    • The period at the end of this command is important! It says ignore creating a new folder and put the contents of our new project in the current directory.

Wrap-up

Once you've finished up your work on the project make sure to call the deactivate command to exit your virtual environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment