GithubHelp home page GithubHelp logo

p3_catalog's Introduction

###Package:

  1. static - directory with static files (currently holds only style.css)
  2. templates - directory with html templates
  3. catalog.py - main file
  4. client_secrets.json - authorization file for Google API
  5. csql.py - python file to work with PostgreSQL database
  6. readme.md - deployment instructions and other usefull info

###Requires:

  1. PostgreSQL Server
  2. Python 2.7
  3. Python modules:

To install python packages I recommend to use pip installer (https://pip.pypa.io/en/stable/installing/)

###Installation:

  1. Create database
  2. Allow md5 connection to PostgreSQL database
  3. Set connection string in csql.py
  4. Create tables
  5. Server

####1. Database creation #####1.1. Connect to PostgreSQL as administrative user     By default it is postgres user.
    e.g. for Linux:
    sudo -u postgres psql #####1.2. Create PostgreSQL role for application     CREATE USER user_name; #####1.3. Set password for created role     ALTER ROLE user_name WITH PASSWORD 'password'; #####1.4. Switch to newly created user     \c user_name #####1.5. Create database     CREATE DATABASE db_name;

####2. Allowing md5 connection to PostgreSQL database #####2.1. Edit pg_hba.conf     for example for default postgreSQL version 9.3 in Ubuntu
    sudo nano /etc/postgresql/9.3/main/pg_hba.conf
    add line with the context
    host db_name user_name host_ip md5
#####2.2. Restart PostgreSQL server     sudo service postgresql restart

####3. Editing csql.py     Find string saying # Database connection settings in csql.py, set credentials accordingly.
    var_dbname - Database name
    var_user - PostgreSQL user name
    var_pass - PostgreSQL user password
    var_host - PostgreSQL server host (by default 'localhost')
    var_port - PostgreSQL server port (by default '5432')
    var_examples - if True insert few example records in the database

####4. Creating application database tables Launch csql.py in command line, for example python csql.py. You will be prompted to create tables.
CAUTION! If you have already tables in database with some information and similar names they will be dropped and overwritten!

####5. Running server You can run the application by simply launching catalog.py file (e.g. python catalog.py), or create wsgi file and run it with nginx, apache, or any other server software supporting wsgi.

p3_catalog's People

Watchers

 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.