installation process with virtualenv and pip

This commit is contained in:
zalun 2010-01-21 23:48:24 +00:00
Родитель 564c3eabd0
Коммит 930d6e35d2
12 изменённых файлов: 161 добавлений и 17 удалений

85
INSTALL
Просмотреть файл

@ -1,10 +1,79 @@
FlightDeck is deployed using Fabric (http://www.fabfile.org)
Install it on your development system
####################
First Installation
All *_local-default* files are shared over the version control system.
These should be copied to corresponding *_local* files and edited to suit the running
operating system.
$ cp settings_local-default.py settings_local.py
$ # change database settings
Virtualenv is providing a stable environment for Django
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/
A bash script automating above is in the scripts directory
Assuming Python 2.5+ is already installed it should be enough to follow these
steps (some commands are specific to Ubuntu with Bash):
1. Install python-setuptools python-dev build-essential
$ sudo apt-get install python-setuptools python-dev build-essential
2. Install Pip and VirtualEnv
$ sudo easy_install -U pip
$ sudo pip install -U virtualenv
3. Create directory for Python environments
$ sudo mkdir /srv; sudo mkdir /srv/python-environments
$ cd /srv/python-environments
$ sudo virtualenv --no-site-packages flightdeck
4. Clear PYTHONPATH (could be optional, but it's working for me)
$ export PYTHONPATH=
5. Install from requirements.txt (#XXX: This is untested due to not accesible server)
$ sudo pip install -E flightdeck/ -r /path/to/projects/FlightDeck/pip-requirements.txt
6. Check if everything is working
* activate flightdeck environment
$ 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/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/pip-requirements.txt
Django==1.1.1
wsgiref==0.1.2
yolk==0.4.1
7. Clone FlightDeck from github
$ cd /path/to/projects/
$ git clone git@github.com:zalun/FlightDeck.git
$ git remote add zalun git@github.com:zalun/FlightDeck.git
8. Configure the Django application
$ chmod a+x scripts/*sh
$ ./scripts/install.sh
$ vi flightdeck/settings_local.py # **
9. Initiate database*
$ ./scripts/syncdb.sh
9. Run Server*
$ ./scripts/runserver.sh
FlightDeck may be accessed by loading http://127.0.0.1:8090/
----
* 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.

25
README
Просмотреть файл

@ -11,18 +11,29 @@ Uses following third-party software:
* Mootools (http://mootools.net/) [MIT]
Directory structure:
.
|-- INSTALL
|-- README
|-- flightdeck # FlightDeck django project contains settings and basic urls
|-- apache
| `-- config_local-default.wsgi
|-- dev.db
|-- flightdeck
| |-- __init__.py
| |-- fabfile_local-default.py
| |-- flightdeck_local-default.wsgi
| |-- manage.py
| |-- requirements.txt
| |-- settings.py
| |-- settings_local-default.py
| |-- settings_local.py
| `-- urls.py
`-- scripts # directory containing usable scripts to develop FlightDeck
|-- install.sh
|-- runserver.sh
`-- syncdb.sh
|-- logs
|-- pip-requirements.txt
|-- scripts
| |-- config_local-default.sh
| |-- environment.sh
| |-- install.sh
| |-- runserver.sh
| `-- syncdb.sh
`-- tools
`-- git-exclude
5 directories, 25 files

Просмотреть файл

Просмотреть файл

@ -2,8 +2,8 @@ ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '../dev.db' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.

3
pip-requirements.txt Normal file
Просмотреть файл

@ -0,0 +1,3 @@
Django==1.1.1
wsgiref==0.1.2
yolk==0.4.1

Просмотреть файл

@ -0,0 +1,8 @@
#!/bin/bash
# define directories
PYTHON_ENVIRONMENTS_DIR='/srv/python-environments/'
PYTHON_ENVIRONMENT='flightdeck'
PROJECT_DIR=`pwd`
PYTHON_COMMAND='python'

8
scripts/environment.sh Normal file
Просмотреть файл

@ -0,0 +1,8 @@
#!/bin/bash
# activate Python flightdeck environment
cd $PYTHON_ENVIRONMENTS_DIR
source $PYTHON_ENVIRONMENT/bin/activate
# set path to the project direcotry
PYTHONPATH=$PROJECT_DIR:$PYTHONPATH

24
scripts/install.sh Normal file → Executable file
Просмотреть файл

@ -0,0 +1,24 @@
#!/bin/bash
# copy configuration files to local
for loc in flightdeck/*_local-default.py
do
cp $loc flightdeck/`basename $loc "-default.py"`.py
echo $loc "->" flightdeck/`basename $loc "-default.py"`.py
done
for wsgi in apache/*_local-default.wsgi
do
cp $wsgi apache/`basename $wsgi "-default.wsgi"`.wsgi
echo $wsgi "->" apache/`basename $wsgi "-default.wsgi"`.wsgi
done
for sh in scripts/*_local-default.sh
do
cp $sh scripts/`basename $sh "-default.sh"`.sh
echo $sh "->" scripts/`basename $sh "-default.sh"`.sh
done
# force exclude local files
cp tools/git-exclude .git/info/exclude
echo tools/git-exclude "->" .git/info/exclude

8
scripts/runserver.sh Normal file → Executable file
Просмотреть файл

@ -0,0 +1,8 @@
#!/bin/bash
source scripts/config_local.sh
source scripts/environment.sh
# run server
cd $PROJECT_DIR/flightdeck/
$PYTHON_COMMAND ./manage.py runserver 8090

9
scripts/syncdb.sh Normal file → Executable file
Просмотреть файл

@ -0,0 +1,9 @@
#!/bin/bash
source scripts/config_local.sh
source scripts/environment.sh
# run server
cd $PROJECT_DIR/flightdeck/
$PYTHON_COMMAND ./manage.py syncdb

Просмотреть файл

@ -5,5 +5,9 @@
# *.[oa]
# *~
*local.py
*local.wsgi
*local.sh
dev.db
logs
*.pyc
.*swp