/bd2

Primary LanguagePython

bd2

Installation:

Ubuntu/Debian:

  1. Install Python 3.5, PostgreSQL and virtualenv:
$ sudo apt-get install python3-pip python3-dev postgresql  
$ pip3 install virtualenv
  1. Create new virtual environment and enter it:
$ virtualenv ENV  
 #Where ENV is a directory to place the new virtual environment  
$ source ENV/bin/activate  
  1. clone repo and cd into it and type in shell:
$ pip3 install -r requirements.txt

Windows:

  1. Install
  1. Add Postgresql\version\bin and Python installation directory to $PATH if they are not added
  2. Open Command Prompt and type:
> pip install virtualenv
> virtualenv ENV
 #Where ENV is a directory to place the new virtual environment
> call ENV\Scripts\activate.bat
  1. clone repo, cd into it ant type in cmd:
> pip install -r requirements.txt

Configure database:

  • user info:
    username: storeuser password: password
  • db:
    name: store,

Ubuntu/Debian:

$ sudo -u postgres createuser --no-superuser --createdb --no-createrole storeuser  
$ sudo -u postgres createdb -O storeuser store  
$ sudo -u postgres psql -c "alter user storeuser with encrypted password 'password';"  

TEST:

$ psql store -U storeuser

If you get: "psql: FATAL: Peer authentication failed for user "storeuser"",
modify file /etc/postgresql/9.5/main/pg_hba.conf by changing line "local all all peer" to "local all all md5".
Restart server #/etc/init.d/postgresql restart (or sudo service postgresql restart)

Windows:

> createuser -U postgres --no-superuser --createdb --no-createrole storeuser
> createdb -U postgres -O storeuser store
> psql -U postgres -c "alter user storeuser with encrypted password 'password';"

Prepare database and run server:

Prepare db: (should be done once and before first server start)

$ python sklep/manage.py migrate

Run server:

$ python sklep/manage.py runserver localhost:8000

Site is now visible at localhost:8000 (or 127.0.0.1:8000)