概要
E-commerce by Django Rest Framework
ビジネス・金融計測したスター増加
- 24時間
- +1
- 7日間
- +1
- 15日間
- +1
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルEcommerce API
Documentation:
Installation:
-> you must install Elastic Search on your computer (you can use brew)
System Dependencies:
- 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 virtualenvsudo apt-get install -y python3-pip - Create a virtual environment on Linux or Mac:
virtualenv -p python3 ~/.virtualenvs/ecommerce - Activate the virtual environment on Linux or Mac:
source ~/.virtualenvs/ecommerce/bin/activate - Install requirements in the virtualenv:
pip3 install -r requirements.txt
Relational database dependencies (PostgreSQL):
Install components for Ubuntu:
sudo apt-get updatesudo apt-get install python-dev libpq-dev postgresql postgresql-contribSwitch to postgres (PostgreSQL administrative user):
sudo su postgresLog into a Postgres session:
psqlCreate database with name ecommerce:
CREATE DATABASE ecommerce;Create a database user which we will use to connect to the database:
CREATE USER ecommerce_user WITH PASSWORD 'ecommerce_pass';Modify a few of the connection parameters for the user we just created:
ALTER ROLE ecommerce_user SET client_encoding TO 'utf8';ALTER ROLE ecommerce_user SET default_transaction_isolation TO 'read committed';ALTER ROLE ecommerce_user SET timezone TO 'UTC';Give our database user access rights to the database we created:
GRANT ALL PRIVILEGES ON DATABASE ecommerce TO ecommerce_user;Exit the SQL prompt and the postgres user's shell session:
\qthenexitActivate the virtual environment:
source ~/.virtualenvs/ecommerce/bin/activateMake Django database migrations:
python manage.py makemigrations
then:python manage.py migrate
Use admin interface:
- Create an admin user:
python manage.py dosuperuser - Run the project locally:
python manage.py runserver - Navigate to:
http://localhost:8000/admin/
Steps for install Celery and work it.
- 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 ecommerce worker -l info
Setup for Django Channels
- if you face any problems on server pleas run these commands on production
- sudo service supervisor stop
- sudo service supervisor start
- sudo supervisorctl reread
- sudo supervisorctl update
- sudo service nginx restart
- 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=ecommerce -f /tmp/ecommerce.psql
pg_restore -v --host= --port=5432 --username= --password --dbname=ecommerce /tmp/ecommerce.psql
関連プロジェクトを探す
読み込み中…