Attachment '00_startproject_out.sh'

Download

$ # Som v mojom domovskom adresari
$ # spravim si adresar na djangovske projekty
$ #
$ mkdir django
$ #
$ # vleziem donho
$ #
$ cd django
$ #
$ # vytvorim projekt s nazvom minidata
$ #
$ django-admin startproject minidata
$ ls -l
celkom 0
drwxr-xr-x 2 gejza gejza 168 2009-02-23 20:59 minidata
$ #
$ # vznikol novy adresar s projektom, vlezme don
$ #
$ cd minidata
$ ls -l
celkom 12
-rw-r--r-- 1 gejza gejza    0 2009-02-23 20:59 __init__.py
-rwxr-xr-x 1 gejza gejza  542 2009-02-23 20:59 manage.py
-rw-r--r-- 1 gejza gejza 2777 2009-02-23 20:59 settings.py
-rw-r--r-- 1 gejza gejza  541 2009-02-23 20:59 urls.py
$ #
$ # popis obsahu adresara:
$ # __init__.py je inicializacny modul balicka minidata
$ # manage.py je program, ktory nam umoznuje spravovat nas projekt
$ # settings.py je modul s nastaveniami
$ # urls.py obsahuje mapovanie URL na views
$ #
$ # Dolezite je nastavit teraz v settings.py
$ # pouzitu databazu.
$ #
$ # Ak chceme pouzivat sqlite (to je pre takyto skusobny projekt
$ # najjednoduchsie), treba nastavit
$ #
$ # DATABASE_ENGINE = 'sqlite3'
$ #
$ # a aj meno databazy napr. takto
$ #
$ # DATABASE_NAME = 'meno_databazy.db'
$ #
$ # Tuna to spravim pomocou sedu, ale samozrejme
$ # kazda pricetna osoba by to zeditovala.
$ #
$ sed -i "s/DATABASE_ENGINE.*/DATABASE_ENGINE = \'sqlite3\'/" settings.py
$ sed -i "s/DATABASE_NAME.*/DATABASE_NAME = \'meno_databazy.db\'/" settings.py
$ #
$ # manage.py budeme pouzivat casto.
$ # V pripade, ze nie je spustitelny (to zavisi od verzie
$ # djanga alebo distribucie), je vhodne ho zospustitelnit.
$ #
$ chmod a+x manage.py
$ ls -l manage.py
-rwxr-xr-x 1 gejza gejza 542 2009-02-23 20:59 manage.py
$ #
$ # V settings.py su v casti INSTALLED_APPS na konci
$ # defaultne nakonfigurovane niektore aplikacie (autentifikacia,
$ # sprava uzivatelov a podobne)
$ #
$ # Tieto pouzivaju databazu. Inicializaciu
$ # databaz zabezpecime prikazom ./manage.py syncdb
$ yes no | ./manage.py syncdb
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): Installing index for auth.Permission model
Installing index for auth.Message model
$ # Teraz uz mozeme spustit prazdny projekt
$ # django pocuva na http://localhost:8000/
$ ./manage.py runserver
Validating models...
0 errors found

Django version 1.0.2 final, using settings 'minidata.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
 

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.