Last active
August 29, 2015 14:26
-
-
Save winnietong/b764129ef05a0d3d7271 to your computer and use it in GitHub Desktop.
How to start a Django Project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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