Skip to content

Update setup.md #989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# Fox linux users
sudo apt-get install libjpeg-dev libpng-dev libpq-dev libxml2-dev libxslt1-dev libmagic-dev
# For mac users
brew install libpng libjpeg libpqxx libmagic swig curl
brew install libpng libjpeg libpqxx libmagic swig curl openssl
# Update pip to latest version
pip install --upgrade pip
# Install libraries that depend on openssl
PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/opt/homebrew/opt/openssl@3/include/lib -L/opt/homebrew/opt/curl/lib" CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include -I/opt/homebrew/opt/curl/include" pip install --compile --no-cache-dir pycurl
env LDFLAGS="-L$(brew --prefix openssl)/lib" \
Expand All @@ -32,11 +34,28 @@ CREATE DATABASE cscdb;
CREATE USER csc WITH password 'FooBar';
ALTER USER csc with CREATEDB;
GRANT ALL privileges ON DATABASE cscdb TO csc;
ALTER USER csc WITH SUPERUSER;
\c cscdb
GRANT ALL ON SCHEMA public TO csc;
ALTER SCHEMA public OWNER TO csc;
\q
```

* Create virtualenv for the project, activate it and install all python dependencies with pipenv (see Pipenv.lock in the root dir)
* Create virtualenv for the project, activate it and install all python dependencies with pipenv (see Pipenv.lock in the root dir). Possible commands:
```bash
# Install pyenv
brew install pyenv

# Install dependencies
pip install --user pipenv
pipenv install --dev
```

* Run migrations
```bash
make migrate
```

```bash
# Or simply generate an empty database
$ python manage.py migrate --settings=compscicenter_ru.settings.local
Expand All @@ -45,6 +64,14 @@ $ python manage.py migrate --settings=compscicenter_ru.settings.local
* Create `.env` file and place it under `compscicenter_ru/settings/` directory. The easiest way is to copy and rename `.env.example` which could be find in the target directory.


### Running

Don't forget to setup site-frontend. Then:

```bash
pyenv shell
make run
```


## Production setup
Expand Down
6 changes: 6 additions & 0 deletions lms/settings/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ DEBUG=1
LOG_FORMAT=simple
REVERSE_URL_SCHEME=http
DATABASE_URL=postgresql://csc:FooBar@localhost:5432/cscdb
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_USER=csc
DATABASE_PASSWORD=FooBar
DATABASE_ENGINE=django.db.backends.postgresql
DATABASE_NAME=cscdb
REDIS_HOST=127.0.0.1
REDIS_SSL=0
REDIS_DB_INDEX=0
Expand Down