Необходимо многое удалить. Не реализована до конца реаомендательная система с использование GPT. По изначальной задумке должен был быть чат вида:
- хочу посмотреть фильмы с тем-то или кем-то или по настроению
- gpt выдаёт результаты с фильмами из картотеки (выдаёт вместе со ссылками и постерами), либо говорит, что такого к сожалению нет, но есть вот этот список...
Install direnv
Add direnv hook to your shell https://direnv.net/docs/hook.html
Description:
In ~/.bashrc add line at the end of file: eval "$(direnv hook bash)"
Allow direnv: direnv allow.
source_env .direnvrc
layout python
layout postgres
# Activate local venv
source $VIRTUAL_ENV/bin/activate
#For enable django-admin runserver need add backend into PYTHONPATH
export PYTHONPATH=$PWD/backend
export DJANGO_SETTINGS_MODULE=backend.settings
export CDN_VIDEO_USERNAME=...
export CDN_VIDEO_EMAIL=...
export CDN_VIDEO_PASSWORD=...
export OPENAI_API_KEY=...
export DJANGO_SETTINGS_MODULE=backend.settings export PYTHONPATH=backend export USER=postgres export PGPASSWORD=admin export PGHOST=localhost export PGPORT=5432 export OPENAI_API_KEY=...
Before, create venv with command:
py -m venv venv
Also, disable restriction for PowerShell (need execute from administrator):
Set-ExecutionPolicy Unrestricted -Force
After, run venv and export env variables:
venv\Scripts\Activate.ps1
$Env:DJANGO_SETTINGS_MODULE="backend.settings"
$Env:PYTHONPATH="backend"
$Env:USER="postgres"
$Env:PGPASSWORD="admin"
$Env:PGHOST="localhost"
$Env:PGPORT="5432"
If you has access to CDN then add credentials
$Env:CDN_VIDEO_USERNAME="..."
$Env:CDN_VIDEO_EMAIL="..."
$Env:CDN_VIDEO_PASSWORD="..."
If you don't have access then will be used default file storage.
For using GPT need API Key:
$Env:OPENAI_API_KEY=""
If django-admin runserver not work then run python -m manage runserver.
- Create org with
django-admin create_org - Create superuser with
createsuperuser
which command for get path
Message from console: """ You can now start the database server using: pg_ctl -D /home/rydvi/Documents/videoservice/videoservice-backend/.direnv/postgres -l logfile start pg_ctl -D $PGDATA -l logfile start """
But start need with command "postgres". After all will work. Before, symbolic links to commands are needed if they are not found
To find command use: find / -name initdb
-
initdb not foud Add symbolic link to initdb: sudo ln -s /usr/lib/postgresql/14/bin/initdb /usr/local/bin/
-
pg_ctl not found Add symbolic link to pg_ctl: sudo ln -s /usr/lib/postgresql/14/bin/pg_ctl /usr/local/bin/
-
postgres not found Add symbolic link to postgres: sudo ln -s /usr/lib/postgresql/14/bin/postgres /usr/local/bin/
-
Install: sudo apt-get install -y libpq-dev pip install psycopg2 pip install psycopg2-binary
If not working then uninstall both psycopg2 and psycopg2-binary and reinstall only psycopg2-binary
-
Allow for node port :80 sudo apt-get install libcap2-bin sudo setcap cap_net_bind_service=+ep
readlink -f \which node`` -
Add in hosts next hosts Windows 10 — «C:\Windows\System32\drivers\etc\hosts» Linux — «/etc/hosts» Mac OS X — «/private/etc/hosts»
127.0.0.1 blue.videoservice.com 127.0.0.1 red.videoservice.com 127.0.0.1 green.videoservice.com 127.0.0.1 videoservice.com
-
Optional. If process already used. sudo kill -9 $(sudo lsof -t -i:80)
devtool: 'inline-source-map' used for it
- yarn build or yarn build-producation
- npx source-map-explorer dist/*.js --html result.html
source_env .direnvrc layout python layout postgres
source $VIRTUAL_ENV/bin/activate #For enable django-admin runserver need add backend into PYTHONPATH export PYTHONPATH=$PWD/backend export DJANGO_SETTINGS_MODULE=backend.settings export CDN_VIDEO_USERNAME= export CDN_VIDEO_EMAIL= export CDN_VIDEO_PASSWORD=