Giter Club home page Giter Club logo

rv-041webui-python's Introduction

RV-041WebUI/Python

Project requires Python 2.7

Install instructions on ubuntu:

  1. Install essential for pip

sudo apt-get install python-pip python-dev build-essential

  1. Install virtualenv

sudo pip install --upgrade virtualenv

  1. Create virtualenv

virtualenv ~/venv/<Your venv name>

  1. Install posgresql

sudo apt-get install postgresql postgresql-contrib

  1. Configure posgres db
sudo -u postgres psql
>>>CREATE USER admin WITH ENCRYPTED PASSWORD "12345678";
>>>CREATE DATABASE easyrest OWNER admin;

Or in /etc/postgresql/9.x/main/pg_hba.conf add lines to the bottom of the file:

local   <dbname>    <usrname>                                    peer
host    <dbname>   <usrname>            127.0.0.1        md5 (edited)

and then restart postqresql service

sudo service postgresql restart

  1. Install pip packeges inside virtual env

(venv) pip install -e ".[testing]"

  1. Initialize db(with example data):

(venv) initialize_easyrest_db --fill development.ini

Drop and create empty database

(venv) initialize_easyrest_db --reset development.ini

Drop derivative models from Base

(venv) initialize_easyrest_db --drop development.ini

Reset and fill database

(venv) initialize_easyrest_db --reset --fill development.ini

--drop - Drop derivative models from Base
--fill - Create tables with test data (without create empty tables)
--reset - Drop and create empty database
  1. Run tests

(venv) pytest

  1. Run project

(venv) pserve --reload development.ini

For convinience you can add aliases below (to your .bash_aliases):

alias envoff=`deactivate`
alias envon=`source ~/venv/<Your venv name>/bin/activate`

Alias to run pyramid and node serve in single comand

To run this you also need to specify your venv path in scripts/pyramidrun.sh and node version to use in scripts/noderun.sh (if you don't use nvm delete this line)

alias reston='gnome-terminal --tab -e "$(pwd)/scripts/pyramidrun.sh" --tab -e "$(pwd)/scripts/noderun.sh"'

Deploying via Docker

  1. Install Docker and Docker Compose

Install Docker

Install Docker Compose

  1. Change the database connection in the development.ini to this form.
# sqlalchemy.url = postgresql://localhost/easyrest?user=admin&password=123

# Connection for Docker environment
sqlalchemy.url = postgresql://admin:12345678@db/easyrest
  1. Change the server url in the development.ini to this form.
# listen = localhost:6543

# Url for Docker environment
listen = 0.0.0.0:6543
  1. Run ./smanager up

Services links:

Frontend Backend Adminer


Install instructions on windows:

  1. Make sure that you have python version 2.7

python --version

After installation Python append paths to python.exe (i.e. C:\Python27) and path to directory Scripts (i.e. C:\Python27\Scripts) in the PATH environment variable.

  1. If you are using Python 2 >=2.7.9 downloaded from python.org just make sure to upgrade pip:

python -m pip install -U pip

  1. Install virtualenv

pip install virtualenv

  1. Create virtualenv

virtualenv %VENV%

  1. Activate virtualenv

%VENV%\Scripts\activate

  1. Upgrade packaging tools in the virtual environment

(%VENV%) pip install --upgrade pip setuptools

  1. Install pip packeges inside virtual env

(%VENV%) pip install -e ".[testing]"

  1. Install posgresql and create database

  2. Initialize db

(%VENV%) initialize_easyrest_db --fill development.ini

Drop and create empty database

(%VENV%) initialize_easyrest_db --reset development.ini

Drop derivative models from Base

(%VENV%) initialize_easyrest_db --drop development.ini

Reset and fill database

(%VENV%) initialize_easyrest_db --reset --fill development.ini

--drop - Drop derivative models from Base
--fill - Create tables with test data (without create empty tables)
--reset - Drop and create empty database
  1. Run tests

(%VENV%) pytest

  1. Run project

pserve development.ini

rv-041webui-python's People

Contributors

maxsukhovetskyi avatar viktormovchaniuk avatar razskg avatar evanantoni avatar vitaliibondar avatar dekapito avatar katemalash avatar

Stargazers

 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.