Giter Site home page Giter Site logo

drf-authentication's Introduction

DRF-Authentication

Documentation:

  1. Django
  2. Markdown, used for the formatting of this README file.

Installation:

-> you must install Elastic Search on your computer (you can use brew)
System Dependencies:
  1. Install git on Linux:
    sudo apt-get install -y git
  2. Clone or download this repo.
  3. Install pip and vitualenv on Linux:
    sudo apt-get install -y virtualenv
    sudo apt-get install -y python3-pip
  4. Create a virtual environment on Linux or Mac:
    virtualenv -p python3 ~/.virtualenvs/Taskkez
  5. Activate the virtual environment on Linux or Mac:
    source ~/.virtualenvs/Taskkez/bin/Taskkez
  6. Install requirements in the virtualenv:
    pip3 install -r requirements.txt
Relational database dependencies (PostgreSQL):
  1. Install components for Ubuntu:
    sudo apt-get update
    sudo apt-get install python-dev libpq-dev postgresql postgresql-contrib

  2. Switch to postgres (PostgreSQL administrative user):
    sudo su postgres

  3. Log into a Postgres session:
    psql

  4. Create database with name Taskkez:
    CREATE DATABASE taskkez;

  5. Create a database user which we will use to connect to the database:
    CREATE USER taskkez_user WITH PASSWORD 'taskkez_pass';

  6. Modify a few of the connection parameters for the user we just created:
    ALTER ROLE taskkez_user SET client_encoding TO 'utf8';
    ALTER ROLE taskkez_user SET default_transaction_isolation TO 'read committed';
    ALTER ROLE taskkez_user SET timezone TO 'UTC';

  7. Give our database user access rights to the database we created:
    GRANT ALL PRIVILEGES ON DATABASE taskkez TO taskkez_user;

  8. Exit the SQL prompt and the postgres user's shell session:
    \q then exit

  9. Activate the virtual environment:
    source ~/.virtualenvs/Taskkez/bin/activate

  10. Make Django database migrations: python manage.py makemigrations
    then: python manage.py migrate

Use admin interface:
  1. Create an admin user:
    python manage.py dosuperuser
  2. Run the project locally:
    python manage.py runserver
  3. Navigate to: http://localhost:8000/admin/
Steps for install Celery and work it.
  1. pip install -r requirements.txt
  2. sudo apt-get install -y erlang
  3. sudo apt-get install rabbitmq-server
  4. sudo systemctl enable rabbitmq-server
  5. sudo systemctl start rabbitmq-server to check if rabbitmq is working run: systemctl status rabbitmq-server
  6. run local server for backend
  7. run this command in new terminal in project path with activating virtual env: celery -A Taskkez worker -l info

Setup for Django Channels

  1. Django Channels Deploy
  2. Daphne
  3. Django Channels configration on server

- if you face any problems on server pleas run these commands on production

  1. sudo service supervisor stop
  2. sudo service supervisor start
  3. sudo supervisorctl reread
  4. sudo supervisorctl update
  5. sudo service nginx restart
  6. sudo service apache2 restart

API Endpoints

Register

Method: POST
Endpoint: /registration/
Payload:
{ "username": "USERNAME", "password1": "PASSWORD", "password2": "PASSWORD", "email": "OPTIONAL_EMAIL" }

Login

Method: POST
Endpoint: /login/
Payload:
{ "username": "USERNAME", "password": "PASSWORD" }

Logout

Method: POST
Endpoint: /logout/
Headers: Authorization: JWT YOUR_TOKEN_HERE

Admin Credentials

Username: admin

Password: admin

For Dump and Load data

you should creating a folder to do this operations
for dump data from database:
python manage.py dumpdata products --format json --indent 4 > products/fixures/products.json
For loading data into database:
python manage.py loaddata products/fixures/products.json

dump and restoredatabase:

pg_dump dbname=Taskkez -f /tmp/Taskkez.psql

pg_restore -v --host= --port=5432 --username= --password --dbname=Taskkez /tmp/Taskkez.psql

drf-authentication's People

Contributors

thomas434 avatar

Watchers

James Cloos avatar Thomas Said avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.