Django Girls blog
- Install better virtual environment. Either
virtualenv
orvirtualenvwrapper
- For
virtualenv
:pip install virtualenv
- For
virtualenvwrapper
:pip install virtualenvwrapper
(Note: may not work on Windows) - Create virtualenv. Either
virtualenv virtual && source virtual/bin/activate
ormkvirtualenv blog && workon blog
- Install Django
pip install Django
- Freeze requirements
pip freeze > requirements.txt
- Note: Next time install project with
pip install -r requirements.txt
- For Windows:
https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe
- For Mac:
https://download.docker.com/mac/stable/Docker.dmg
- Run Docker service in background
- Create database service
docker-compose up
- After first boot database service will require restart
- Restart database service with
Ctrl+C
and run againdocker-compose up
- Do not close database service terminal window
- Change database config in
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'localhost',
'PORT': 5433,
}
}
- Install PostgreSQL support library
pip install psycopg2
- Apply migrations
python manage.py migrate
- Create superuser
python manage.py createsuperuser
- Configure new postgres connection under
localhost:5433
- Use database
postgres
and loginpostgres
- View tables
auth_user
,django_migrations
andblog_post
- Run server
python manage.py runserver
- Create your own branch
git checkout -b $name
- Use
django-admin startapp $name
orpython manage.py startapp $name
where$name
is your name - Add changes with
git add . && git commit -m "Your message here."
- Push it to GitHub
git push origin $name
- Install
https://github.com/django-extensions/django-extensions
- Install
https://github.com/bpython/bpython
- Remember to freeze requirements
pip freeze > requirements.txt
- Use
python manage.py shell_plus
- Notice how models are automatically loaded and how autocomplete works
- Use
shell_plus
in future in favour ofshell
- Add, commit and push changes to your branch on GitHub
- Make your first Pull Request on GitHub (your branch to master)
- Django Girls extension (skip optional steps):
https://djangogirls.gitbooks.io/django-girls-tutorial-extensions
- Do some agile stuff (daily, retro, brainstorming and planning)
- Conquer the moon!