Django for Designers: Difference between revisions

no edit summary
imported>Aldeka
imported>Aldeka
No edit summary
Line 30:
=== Part 1: Starting our project ===
 
This tutorial goes through the process of building a simple social bookmarking application, where users can save various URLs and tag those bookmarks to make them easier to find later. Our bookmarks application will be built on top of Django, a full-featured web framework written in Python.
What we're building today -- a simple social bookmarking application
 
==== Activate your env ====
 
The first step is to open your terminal window, navigate to the folder where you plan to store your app code (where you set up your virtualenv for this tutorial earlier) and activate your env:
Start your project
 
<source>$ source env/bin/activate</source>
Set up your settings and database
 
You'll know it worked because afterwards, you'll see <source>(env)</source> at the front of all your terminal lines in that terminal window!
 
====Start your project====
 
If you're following this tutorial at PyCon, in your terminal, run:
 
<source>$ git clone git://github.com/aldeka/pycon-django-tutorial.git</source>
 
This will download a few files that we'll be using in this tutorial.
 
Additionally, this sets us up to use a program called git to save our progress and sync up later, in case any of you get stuck. If you're not familiar with git, git is a version control system that tracks changes you make to files within a git repository (the folder you just cloned). You make commits in git, which are like save points in video games -- the commit messages tell you what changes are included in this commit. If later on you make some changes and delete something or mess something up, you can always go back to a previous commit and try again.
 
Git also has "branches"--parallel timelines where you can go off from the main branch (called "master") and try something out. It's often a good idea to start a new branch when you're writing a new feature. You can make as many commits as you want inside the branch, and it won't affect the main master timeline. You can make as many branches as you want, and branches of branches. You can even share branches with others (though we won't be doing that today). Git's branching system (and its non-centralized architecture generally) make it easy to try out new ideas in code without having to ask permission of everyone else who might be working on the same code as you. Then, when your new feature is done, you can then merge (or rebase--the exact process would take a much longer explanation) the changes back into the master timeline.
 
We'll be using the master branch (the default name for the main branch of code, which you're in right now) for syncing up throughout the class in case you get lost. You'll need to make your own branches for playing with the code on your computer, so that it doesn't interfere w. re-syncing later.
 
To make your first branch, first enter the pycon-django-tutorial directory:
 
<source>$ cd pycon-django-tutorial</source>
 
Then enter:
 
<source>$ git branch my-branch-1</source>
 
Congratulations! You're now in a branch named my-branch-1!
 
You can see what branch you are in (and what branches are in your repository) at any time by typing:
 
<source>$ git branch</source>
 
====Set up your settings and database====
 
Projects vs. apps distinction
Anonymous user