Git Product home page Git Product logo

picker's Introduction

Command which you need:

sudo apt-get install python-dev
sudo apt-get install libevent-dev
sudo easy_install -U gunicorn
sudo apt-get install python-software-properties -y
sudo apt-get install nginx
sudo apt-get install postgresql
sudo apt-get install postgresql-server-dev-9.1 
sudo apt-get install python-lxml

Unwrap project:

git clone git://github.com/alexkos/picker.git
pip install -r requirements.txt

Create settings.py

In database user:your_username, pass:your_password, name:database_name

email_host  = smtp.yandex.ru
email_port  = 587
EMAIL_HOST_USER        = 'your email'
DEFAULT_FROM_EMAIL     = 'your email'
EMAIL_HOST_PASSWORD    = 'your email password'

Must be installed PostgreSQL in system, if not then to make command:

sudo passwd postgres
sudo -u postgres createuser -P name_user_db
su postgres
psql template1
CREATE DATABASE database_name OWNER name_admin ENCODING 'UTF8';

Edit the Postgres permissions in /etc/postgresql/9.1/main/pg_hba.conf by adding a line as follows after the postgres user line:
local      database_name   name_user_db   md5
host all all 0.0.0.0/0  md5

Then:
sudo /etc/init.d/postgresql restart

After installing psycopg:

sudo apt-get install python-psycopg2
pip install psycopg2 
		or
easy_installed psycopg2


./manage.py syncdb
username: name_admin
email:your_email
password: password

Then to perform command in root project, where is 
./manage.py migrate capturing

./manage.py dbshell
ALTER TABLE capturing_textsite ADD COLUMN text_tsv tsvector;
CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE ON capturing_textsite FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger(text_tsv, 'pg_catalog.english', text);
CREATE INDEX capturing_textsite_tsv ON capturing_textsite USING gin(text_tsv);
UPDATE capturing_textsite SET text_tsv=to_tsvector(text);


Put in *.sh script:

#!/bin/bash
  set -e
  LOGFILE=/var/log/gunicorn/picker.log
  LOGDIR=$(dirname $LOGFILE)
  NUM_WORKERS=2
  # user/group to run as
  # (username) and (usergroup)
  USER=user  
  GROUP=user
  echo "start service"
  cd /home/user/project/picker
  test -d $LOGDIR || mkdir -p $LOGDIR
  gunicorn_django -w $NUM_WORKERS \
    --user=$USER --group=$GROUP --daemon --log-level=debug \
    --log-file=$LOGFILE 2>>$LOGFILE 


Create conf file for nginx:

server {
    listen   80;
    server_name picker.com;
    # no security problem here, since / is alway passed to upstream
    root /home/user/project/picker;
    # serve directly - analogous for static/staticfiles
    location /media/ {
        # if asset versioning is used
        if ($query_string) {
            expires max;
        }
    }
    location /admin/media/ {
        # this changes depending on your python version
        root /path/to/test/lib/python2.6/site-packages/django/contrib;
    }

    location /static/ {
        alias /home/user/project/picker/staticfiles/;
        autoindex off;

     }
    location / {
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_connect_timeout 10;
        proxy_read_timeout 10;
        proxy_pass http://localhost:8000/;
    }
    # what to serve if upstream is not available or crashes
    error_page 500 502 503 504 /media/50x.html;
}

 ./manage.py collectstatic

picker's People

Contributors

alexkos avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.