Skip to content

Instantly share code, notes, and snippets.

@winnietong
Last active August 29, 2015 14:26
Show Gist options
  • Save winnietong/b764129ef05a0d3d7271 to your computer and use it in GitHub Desktop.
Save winnietong/b764129ef05a0d3d7271 to your computer and use it in GitHub Desktop.
How to start a Django Project
- Click on PyCharm -> Preferences
- Click on Project Interpreter -> Python Interpreter
- Click on the "+" -> Local
- Go to your home directory -> .virtualenvs -> writers -> bin
- Choose the file that's just called python
- mkvirtualenv yourenvname
- requirements:
- pip install django
- pip install psycopg2
- django-admin.py start project your_project_name (this creates a directory and project for you)
- cd your_project_name
- python manage.py startapp your_app_name
- Add your app to the INSTALLED_APPS section in settings.py
- psql -h localhost postgres
- CREATE DATABASE database_name;
- Add local_settings.py to your project’s main directory
- Set your database default. Typically:
DATABASES = {
default: {
‘ENGINE’: ‘django.db.backends.postgresql_psycopg2’,
’NAME’: ‘database_name’,
‘HOST’: ‘localhost’
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment