Difference between revisions of "Django app"

From Finninday
Jump to: navigation, search
(install python mysql connector)
Line 72: Line 72:
 
+++-===========================-==================-==================-============================================================
 
+++-===========================-==================-==================-============================================================
 
ii  python-mysqldb              1.2.3-2ubuntu1    amd64              Python interface to MySQL
 
ii  python-mysqldb              1.2.3-2ubuntu1    amd64              Python interface to MySQL
 +
</pre>
 +
 +
=== create a mysql database ===
 +
<pre>
 +
mysql> create database django character set utf8;
 +
Query OK, 1 row affected (0.04 sec)
 
</pre>
 
</pre>

Revision as of 04:30, 5 May 2014

Notes while running through the Django tutorial.

First, browse the overview here: https://docs.djangoproject.com/en/1.6/intro/overview/

The real tutorial is here: https://docs.djangoproject.com/en/1.6/intro/tutorial01/

Oops, have to install (https://docs.djangoproject.com/en/1.6/intro/install/) before doing the tutorial.

Ahh, I guess it *is* installed:

rday@weasel:~/bin$ dpkg -l "*django*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                        Version            Architecture       Description
+++-===========================-==================-==================-============================================================
ii  python-django               1.6.1-2ubuntu0.2   all                High-level Python web development framework
un  python-django-doc           <none>             <none>             (no description available)
ii  python-django-tagging       1:0.3.1-3          all                Generic tagging application for Django projects

rday@weasel:~/bin$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
1.6.1

OK, back to the tutorial.

rday@weasel:~/church-django$ django-admin.py startproject mysite
rday@weasel:~/church-django$ tree
.
└── mysite
    ├── manage.py
    └── mysite
        ├── __init__.py
        ├── settings.py
        ├── urls.py
        └── wsgi.py

2 directories, 5 files

sidebar to set up git repo for the code

Tried running the development server on weasel, but ran into firewall rules. Moved development to a workstation which is more in the spirit of the tutorial.

Had to install django there...

root@ferret:~/git/church-django/mysite# apt-get install python-django

And get the codebase

rday@ferret:~/git$ git clone ssh://weasel/drobo2/git/church-django.git
Cloning into 'church-django'...

install python mysql connector

root@ferret:~/git/church-django/mysite/mysite# dpkg -l python-mysqldb
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                        Version            Architecture       Description
+++-===========================-==================-==================-============================================================
ii  python-mysqldb              1.2.3-2ubuntu1     amd64              Python interface to MySQL

create a mysql database

mysql> create database django character set utf8;
Query OK, 1 row affected (0.04 sec)