This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME
224 lines (145 loc) · 7.96 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
.. image:: rancho_logo.png
:align: center
==================================================
Rancho: Open Source Group/Project Management Tool
==================================================
:Author: The Rancho Team
:Contact: [email protected]
:Date: 2009-11-15
:Web site: http://www.getrancho.com
:License: Rancho is published under the GNU AGPL v3 license.
.. contents::
Introduction
=============
Rancho is an Open Source web based tool developed with Django to manage groups of people and projects.
This document gives a brief explanation on how to install Django. Please note that deploying or optimizing Rancho is not the purpose of this document, thus, such subjects are not covered.
The installation of Rancho on a Debian based system using the PostgreSQL database is also included in order to provide an example.
System Requirements
====================
Here are the system requirements to run Rancho.
* Linux/UNIX operating system;
* Django (http://www.djangoproject.com);
* MySQL>=4.0.1 (http://www.mysql.com) OR PostgreSQL>=8.3 (http://www.postgresql.com);
* Python MySQLDB (http://mysql-python.sourceforge.net/) in case of using the MySQL database;
* PsycoPG (http://www.initd.org) in case of using the PostgreSQL database;
* pytz (http://pytz.sourceforge.net/);
* PIL - Python Image Library - (http://www.pythonware.com/products/pil/);
* ReportLab>=2.2 (http://www.reportlab.org/downloads.html);
* html5lib - Library for working with HTML5 documents (http://code.google.com/p/html5lib/);
* XHTML2PDF - HTML to PDF converter (http://www.xhtml2pdf.com/)
* ElementTree - A container object, designed to store hierarchical data structures. THIS IS ONLINE NEEDED IN PYTHON<=2.4 (http://effbot.org/zone/element-index.htm)
Getting the Code
=================
Rancho's latest release can be downloaded from:
http://www.getrancho.com/download
The GIT version of Rancho can be checked out using the following command::
$ git clone http://git.getrancho.com/rancho.git
Configuration
==============
Once the system requirements are met and the code is downloaded, the first thing to do is to edit the settings_customize.py file found on the project's root folder. This file already contains several strings that give hints on how to configure it.
External Modules
=================
Rancho uses some external Django appls. There is a script to easily get those apps called *get_externals.sh*. To run the script you can do as follows::
$ ./get_externals.sh
Installation on Debian
=======================
This section covers the installation of Django on a Debian system (or Debian based like Ubuntu). The database used for this example is PostgreSQL which is assumed to be already installed locally as well as Rancho. For this example, the database user is assumed be 'jsmith' with the password 'qwerty'.
Run the following command as superuser to install the other requirements::
# apt-get install python-psycopg python-tz python-imaging python-reportlab python-html5lib
# easy_install pisa
Once the packages finish being installed, create a database to be used by Rancho::
$ createdb ranchodb
After this, Rancho needs to be configured. Edit the settings_customize.py file as follows::
SEARCH_ENGINE = 'postgresql'
DATABASE_ENGINE = 'postgresql'
DATABASE_NAME = 'ranchodb'
DATABASE_USER = 'jsmith'
DATABASE_PASSWORD = 'qwerty'
DATABASE_HOST = ''
DATABASE_PORT = ''
After the database settings, the email settings need to be configured in order for notifications to be sent. The values given to the settings bellow are also fictional in order to better examplify the configuration::
DEFAULT_FROM_EMAIL = '[email protected]'
EMAIL_HOST = 'smtp.example.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'qwerty'
After this, rename the file as settings.py and that's it with Rancho configuration. The next step is to create the database tables and Rancho's initial information like the account owner and the default company::
$ python manage.py syncdb
$ python manage.py migrate
Answer yes to the question to create a superuser and then supply the rest of the information asked.
Once the previous command is finished, it's time to run Rancho. For this, the Django test server is used::
$ python manage.py runserver
If everything went okay, you can now visit http://localhost:8000 in your web browser to access Rancho. Log in with the information you supplied previously and that's it! Rancho is installed!
**Important**: Note that it is not advisable to use this server for production.
Upgrading Rancho
=================
If you have a Rancho version installed and upgrade it, there might be changes to the
database that must be solved in order, for example, to preserve data.
**Important**: It is advisable to back up all your data before upgrading Rancho.
The first thing to do after having upgraded Rancho is to migrate the database
using the following command::
$ python manage.py migrate
If all went well, Rancho will be ready to be run.
Important Configuration
=======================
When using Rancho in a production environment you have to configure some additional items.
Sending files through Django is very inefficient so you should configure Rancho to use Apache mod-xsendfile. You can get it from: http://tn123.ath.cx/mod_xsendfile/
HOW_SEND_FILE='apache-modsendfile'
You should also define a value for SECRET_KEY since this is used to provide a seed in secret-key hashing algorithms. Set this to a random string -- the longer, the better.
Finally you should setup the cron::
# crontab -e
add the following lines::
0 23 * * * RANCHO_INSTALL_DIR/rancho/manage.py run_cron
0 * * * * RANCHO_INSTALL_DIR/rancho/manage.py send_mail
The cron is run every day at 23h00 and the mail is sent every hour.
Deploying Rancho in mod_wsgi and mod_python
============================================
Here you have a sample deployment for mod_wsgi and mod_python. Visit the Django web site to get more complete information on how to deploy Rancho in a production environment.
mod_wsgi
-------------
Create a new site configuration for apache with::
<VirtualHost *>
ServerName sitename.com
Include "INSTALL_DIR/rancho/apache/apache_django_wsgi.conf"
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
XSendFile on
XSendFileAllowAbove on
</VirtualHost>
Create a directory for apache configuration in your INSTALL_DIR and create two files::
apache_django_wsgi.conf
Alias /media/ "RANCHO_INSTALL_DIR/rancho/media/"
<Directory "RANCHO_INSTALL_DIR/rancho/media">
Order allow,deny
Options -Indexes
Allow from all
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
</Directory>
WSGIScriptAlias / "RANCHO_INSTALL_DIR/rancho/apache/rancho.wsgi"
<Directory "RANCHO_INSTALL_DIR/rancho/apache/">
Allow from all
</Directory>
rancho.wsgi
import os, sys
#Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
sys.path.append(project)
os.environ['DJANGO_SETTINGS_MODULE'] = 'rancho.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
mod_python
----------------
Create a new site configuration for apache with::
<VirtualHost *>
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE rancho.settings
PythonDebug On
PythonPath "['RANCHO_INSTALL_DIR', 'RANCHO_INSTALL_DIR/rancho' ] + sys.path"
</Location>
</VirtualHost>