Project was left in the middle of refactoring process, it most likely in a broken state. Changes just stored to archive it, it's not planned to work on this project anymore.
- Clone this repo and go to the cloned directory:
$ git clone https://github.com/web-izmerenie/avto-lux161 avto-lux161
$ cd avto-lux161
- Install git-submodules:
$ git submodule update --init
- Create Python virtual environment and activate it:
$ pyvenv .venv
$ source ./.venv/bin/activate
- Install Python requirements:
$ pip3 install -r requirements.txt
-
Copy config.yaml.example to
config.yaml
and set inconfig.yaml
: -
DATABASE
— set correct access data to database. According to this guide:
```yaml
DATABASE:
HOST: 'localhost'
PORT: ''
DBNAME: 'avtolux_dbname'
USER: 'avtolux_user'
PASS: 'avtolux_password'
TABLE_NAME_PREFIX: 'avtolux_'
```
-
DEV_SERVER
— if you going to start development server; -
PRODUCTION_SERVER
— if you going to start production server.
WARNING!: don't set instances more than 1, cause it isn't supported yet, need some debug for errors; -
DEBUG
— set to 1 if you wan't more debug info. -
Copy
./files/uploaded/
dir from backup archive to./files/uploaded/
.
Just for example, doing it by extracting from backup (you should be inside root of the project and backup should be placed there too):
$ cd files
$ tar -xzf ../avtolux_files_backup_20150308050634.tar.gz --strip-components=1 files/uploaded/
Or if you don't have any backups skip this item and go to the next one.
- Fill database by database dump from backup archive:
If you have started without any backups read this and skip this item.
$ cat avtolux_db_dump_20150308041213.sql.gz | gunzip | psql -h localhost -d avtolux_dbname -U avtolux_user
Where avtolux_db_dump_20150308041213.sql.gz
is database dump,
avtolux_user
is user for database access
and avtolux_dbname
is a database name;
- Install npm dependencies and build some front-end stuff:
$ npm install
And build optimized production front-end bundles:
$ npm run bundle-production
Or build pretty development bundles and start watcher for development:
$ npm run bundle-development-client
$ npm run bundle-development-admin
It uses webpack for bundling, you can run just this project local webpack executable by this command:
$ npm run webpack
See for scripts
key in package.json
, also you can call webpack
with specific arguments through --
, for example show webpack help:
$ npm run webpack -- --help
- Run web-server:
In debug mode:
$ ./run_development.sh
Or in production mode:
$ ./run_production.sh
After pull fresh revision from git don't forget to run:
$ ./migrate.sh
It automatically checks what migrations needed and then apply them, or it will do nothing if all migrations already applied.
May be you wan't to know how to create new database and new user to access this database? Then read this first.
$ ./avto-lux/manage.py dbsync
And then create new admin user:
$ ./avto-lux/manage.py create-admin
It will create accout with login admin
and password admin
.
WARNING! Do not foget to go later to /adm/
route and change this login/password!
Now you can start development:
$ ./run_development.sh
Or production (doesn't matter):
$ ./run_production.sh
Don't be afraid of 500 error, because we don't have main page yet.
After that you can go to /adm/#panel/pages
route and create main page
(page with path /
).
Now it would be good to add some data fields that used on site,
go to route /adm/#panel/data/add.html
and create this fields
(for name
field in every level just use any useful human-name
and use number value for sort
, main key is symbol key
):
-
phones
: 1.header
text (multiple) 2.footer
text (single) -
email
: 1.footer
text (single) -
counters
: 1.bottom_counters
multiline text (multiple) -
robots
: 1.robots
multiline text (single) with value:User-agent: * Disallow: /adm/ Disallow: /static/admin-templates/ Disallow: /static/ckeditor/
Login as postgres
user:
$ sudo su - postgres
Then open interactive PostgreSQL terminal:
$ psql
Inside that terminal create new user:
named as avtolux_user
with password avtolux_password
:
create user avtolux_user with password 'avtolux_password' ;
After that create new database named as avtolux_dbname
:
create database avtolux_dbname ;
And give user created before all privileges to this new database:
grant all on database avtolux_dbname to avtolux_user ;
You can check if it's done:
\l
Done!
$ pg_dump -h localhost -d avtolux_dbname -U avtolux_user | gzip > avtolux_db_dump_`date +'%Y%m%d%H%M%S'`.sql.gz
Where avtolux_user
is user for database access
and avtolux_dbname
is a database name;
Inside root of the project:
$ tar -czvf avtolux_files_backup_`date +'%Y%m%d%H%M%S'`.tar.gz files/uploaded/