- Install git on Linux:
sudo apt-get install -y git
- Clone or download this repo.
- Install pip and vitualenv on Linux:
sudo apt-get install -y virtualenv
sudo apt-get install -y python3-pip
- Create a virtual environment on Linux or Mac:
virtualenv -p python3 ~/.virtualenvs/microworker
- Activate the virtual environment on Linux or Mac:
source ~/.virtualenvs/microworker/bin/microworker
- Install requirements in the virtualenv:
pip3 install -r requirements.txt
-
Install components for Ubuntu:
sudo apt-get update
sudo apt-get install python-dev libpq-dev postgresql postgresql-contrib
-
Switch to postgres (PostgreSQL administrative user):
sudo su postgres
-
Log into a Postgres session:
psql
-
Create database with name microworker:
CREATE DATABASE microworker;
-
Create a database user which we will use to connect to the database:
CREATE USER microworker_user WITH PASSWORD 'microworker_pass';
-
Modify a few of the connection parameters for the user we just created:
ALTER ROLE microworker_user SET client_encoding TO 'utf8';
ALTER ROLE microworker_user SET default_transaction_isolation TO 'read committed';
ALTER ROLE microworker_user SET timezone TO 'UTC';
-
Give our database user access rights to the database we created:
GRANT ALL PRIVILEGES ON DATABASE microworker TO microworker_user;
-
Exit the SQL prompt and the postgres user's shell session:
\q
thenexit
-
Activate the virtual environment:
source ~/.virtualenvs/microworker/bin/activate
-
Make Django database migrations:
python manage.py makemigrations
then:python manage.py migrate
- Create an admin user:
python manage.py dosuperuser
- Run the project locally:
python manage.py runserver
- Navigate to:
http://localhost:8000/admin/
- pip install -r requirements.txt
- sudo apt-get install -y erlang
- sudo apt-get install rabbitmq-server
- sudo systemctl enable rabbitmq-server
- sudo systemctl start rabbitmq-server to check if rabbitmq is working run: systemctl status rabbitmq-server
- run local server for backend
- run this command in new terminal in project path with activating virtual env: celery -A microworker worker -l info
- sudo service supervisor stop
- sudo service supervisor start
- sudo supervisorctl reread
- sudo supervisorctl update
- sudo service nginx restart
- sudo service apache2 restart
Method: POST
Endpoint: /registration/
Payload:
{ "username": "USERNAME", "password1": "PASSWORD", "password2": "PASSWORD", "email": "OPTIONAL_EMAIL" }
Method: POST
Endpoint: /login/
Payload:
{ "username": "USERNAME", "password": "PASSWORD" }
Method: POST
Endpoint: /logout/
Headers: Authorization: JWT YOUR_TOKEN_HERE