зеркало из https://github.com/mozilla/FlightDeck.git
139 строки
4.6 KiB
Plaintext
139 строки
4.6 KiB
Plaintext
####################
|
|
First Installation
|
|
|
|
Virtualenv is providing a stable environment for Django. (1)
|
|
|
|
Assuming that svn/git/mercurial and Python 2.5+ is already
|
|
installed it should be enough to follow these steps (some
|
|
commands are specific to Ubuntu with Bash):
|
|
|
|
1. Clone FlightDeck from github
|
|
$ sudo apt-get install git-core
|
|
$ cd /path/to/projects/
|
|
$ git clone git@github.com:zalun/FlightDeck.git
|
|
|
|
2. Initiate configuration files
|
|
$ cd /path/to/projects/FlightDeck
|
|
$ ./scripts/initiate.sh
|
|
|
|
3. Install python-setuptools python-dev build-essential libmysqlclient-dev
|
|
$ sudo apt-get install subversion mercurial python-setuptools python-dev build-essential libmysqlclient-dev
|
|
|
|
4. Install Pip and VirtualEnv
|
|
$ sudo easy_install -U pip
|
|
$ sudo pip install -U virtualenv
|
|
|
|
5. Create directory for Python environments
|
|
$ sudo mkdir /srv; sudo mkdir /srv/python-environments
|
|
$ cd /srv/python-environments
|
|
$ sudo virtualenv --no-site-packages flightdeck
|
|
|
|
6. Install via pip from requirements.txt and custom packages
|
|
$ cd /path/to/project/FlightDeck
|
|
$ ./scripts/install.sh
|
|
|
|
7. Check if everything is working
|
|
* activate flightdeck environment
|
|
$ cd /srv/python-environments
|
|
$ source flightdeck/bin/activate
|
|
the PS1 may change (regarding on the settings) to
|
|
(flightdeck)zalun@localhost $
|
|
* display the Django version
|
|
$ django-admin.py --version
|
|
1.1.1
|
|
* check if the same as in requirements file
|
|
$ grep Django /path/to/projects/FlightDeck/tools/pip-requirements.txt
|
|
Django==1.1.1
|
|
* display list of packages
|
|
$ yolk -l
|
|
Django - 1.1.1 - active
|
|
Python - 2.6.4 - active development (/usr/lib/python2.6/lib-dynload)
|
|
pip - 0.6.2 - active
|
|
setuptools - 0.6c11 - active
|
|
wsgiref - 0.1.2 - active development (/usr/lib/python2.6)
|
|
yolk - 0.4.1 - active
|
|
* Check if contains everything from requirements file in the right version plus
|
|
Python, pip and setuptools
|
|
$ cat /path/to/projects/FlightDeck/tools/pip-requirements.txt
|
|
Django==1.1.1
|
|
wsgiref==0.1.2
|
|
yolk==0.4.1
|
|
|
|
8. Configure the Django application
|
|
$ vi flightdeck/settings_local.py # **
|
|
|
|
9. Check local scripts configuration
|
|
$ vi scripts/config_local.sh
|
|
|
|
10. Initiate database*
|
|
$ ./scripts/syncdb.sh
|
|
Choose your superadmin username and password
|
|
|
|
11. Run Server*
|
|
$ ./scripts/runserver.sh
|
|
FlightDeck may be accessed by loading http://localhost:8090/
|
|
Administration from http://localhost:8090/admin/
|
|
|
|
|
|
|
|
##############################
|
|
Extending the Python codebase
|
|
|
|
1. Install the package (example of installing PIL - graphics operations for Python)
|
|
$ cd /srv/python-environments
|
|
$ pip install -E flightdeck/ pil
|
|
|
|
2. Save the requirements
|
|
$ pip freeze -E flightdeck/ > /path/to/projects/FlightDeck/tools/pip-requirements.txt
|
|
|
|
|
|
|
|
##############################
|
|
Adding third party projects
|
|
|
|
1. Install using subversion/git/mercurial if module configured as an egg (2)
|
|
# South is used as an example however we will use pip to install this module
|
|
# Change requirements
|
|
# add following line to FlightDeck/tools/pip-requirements.txt
|
|
# add line
|
|
-e hg+http://bitbucket.org/andrewgodwin/south/@0.6.2#egg=south
|
|
# update environment
|
|
$ cd /srv/python-environments
|
|
$ sudo pip install -E flightdeck/ -r /path/to/projects/FlightDeck/tools/pip-requirements.txt
|
|
|
|
2. Install custom packages
|
|
# Add to the scripts/install.sh
|
|
# checkout the right revisions into $SRC
|
|
sudo svn checkout http://django-grappelli.googlecode.com/svn/trunk/grappelli/ $SRC/grappelli
|
|
# Link module from #SRC to to $SITE_PACKAGES
|
|
if [ ! -e $SITE_PACKAGES/grappelli ]
|
|
then
|
|
$ sudo ln -fs $SRC/grappelli $SITE_PACKAGES/grappelli
|
|
fi
|
|
|
|
|
|
|
|
#####################
|
|
Updating environment
|
|
|
|
1. Install from pip-requirements.txt
|
|
$ cd /srv/python-environments
|
|
$ sudo pip install -E flightdeck/ -r /path/to/projects/FlightDeck/tools/pip-requirements.txt
|
|
|
|
|
|
----
|
|
* Scripts assume one has installed the FlightDeck environment in
|
|
/srv/python-envirenments/flightdeck/ if it is a different one
|
|
please edit the scripts/config_local.sh
|
|
|
|
** No *_local.py file should be shared between users, they contain
|
|
informations relevant only to the local installation of FlightDeck.
|
|
The exclude file is provided by default.
|
|
|
|
----
|
|
(1) Installation of VirtualEnv under Ubuntu is described in detail in this post:
|
|
http://www.saltycrane.com/blog/2009/05/notes-using-pip-and-virtualenv-django/
|
|
|
|
(2) Pip requirements file format
|
|
http://pip.openplans.org/requirement-format.html
|