Project

General

Profile

Entorno de Desarrollo (Django)

Instalar dependencias:

$ sudo apt-get install subversion, apache2, libapache2-mod-wsgi, mysql-server, mysql-client, libmysqlclient-dev, redis-server, python-dev, python-setuptools
$ sudo easy_install pip
$ sudo pip install virtualenv

Crear bases de datos:

$ mysql -u root -p
mysql> CREATE DATABASE radarsys;
mysql> CREATE USER 'developer'@'localhost' IDENTIFIED BY 'idi2015';
mysql> GRANT ALL PRIVILEGES ON radarsys.* TO 'developer'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> exit;

Configurar entorno virtual:

$ mkdir ~/workspace/virtuals/
$ cd ~/workspace/virtuals/
$ virtualenv radarsys

Instalar aplicación web:

$ cd ~/workspace/
$ svn checkout --username=<username> http://jro-dev.igp.gob.pe/svn/jro_hard/radarsys/trunk/webapp/ radarsys
$ cd radarsys
$ source ~/workspace/virtuals/radarsys/bin/activate
(radarsys)$ pip install -r requirements.txt

Crear un usuario en Django:

(radarsys)$ python manage.py createsuperuser --username=admin --email=[email@example.com]
Password: 

Inicializar la aplicación:

(radarsys)$ python manage.py makemigrations
(radarsys)$ python manage.py migrate
(radarsys)$ python manage.py runserver

En producción (to be updated):

(radarsys)$ python manage.py collectstatic
(radarsys)$ deactivate
$
$ cp ~/workspace/radarsys/apache-radarsys.conf /etc/apache2/conf-available/
$ sudo /etc/init.d/apache2 restart

Usando nginx y gunicorn:

(radarsys)$ pip install gunicorn
$ gunicorn radarsys.wsgi:application --bind 127.0.0.1:8000 &
$ service nginx restart

Redis y Celery:

  • Ejecutar Redis:
$ redis-server
  • Ejecutar Celery:
(radarsys)$ pip install redis
(radarsys)$ celery -A radarsys worker -l info