Skip to content
项目

kkosiba/ecommerce-backend

在 GitHub 查看

关于

Django backend for eCommerce project

网站与应用开发

这些数字如何统计

可以做什么

  • Products API endpoint available at /api/products/.
  • Custom user authentication using JSON Web Tokens. The API is available at /api/accounts/.
  • Simple newsletter functionality: superuser can view the list of all subscribers in Django admin panel; any visitor can subscribe. The relevant API endpoint is available at /api/newsletter/.
  • Stripe payments API endpoint available at /api/payments/.

实测星标增长

24小时
0
7天
0
15天
+2
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

ecommerce-backend

Django backend for eCommerce project

This project is built using Django REST Framework to provide the backend API for the eCommerce project. The frontend is available here.

Features

  1. Products API endpoint available at /api/products/.
  2. Custom user authentication using JSON Web Tokens. The API is available at /api/accounts/.
  3. Simple newsletter functionality: superuser can view the list of all subscribers in Django admin panel; any visitor can subscribe. The relevant API endpoint is available at /api/newsletter/.
  4. Stripe payments API endpoint available at /api/payments/.

Dependencies

  1. python >=3.13,<3.14
  2. Django >=5.1,<5.2
  3. PostgreSQL 16+

This project also uses other packages (see requirements/base.txt file for details). For instance, tag support is provided by django-taggit and image processing is thanks to Pillow.

Getting started

The easiest way to get backend up and running is via Docker. See docs to get started. Once set up run the following command:

make run

This command takes care of populating products list with the sample data.

It may take a while for the process to complete, as Docker needs to pull required dependencies. Once it is done, the application should be available at http://localhost:8000.

In order to use Stripe payments one needs to create an account and obtain a pair of keys (available in the dashboard after signing in). These keys need to be set in a .env file, see the Deployment section below for the example contents of such file.

Tests

To run Django tests run the following command:

make test

Deployment

There is a production-ready Docker image production.dockerfile available.

It can be deployed in a Kubernetes cluster for example.

To build it manually:

docker build --file production.dockerfile .

To run this image, you need to set the environment correctly. You can use a .env file like this:

PROJECT_ENVIRONMENT=production

# Django settings

DJANGO_SECRET_KEY="f41z(gp#mm7ktjo1bfux-n*0!mlti$9d1@k_sws@&kl*@tfi21"
DJANGO_SETTINGS_MODULE=src.settings.defaults

# Database settings

POSTGRES_DB=
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_HOST=
POSTGRES_PORT=5432

# Stripe

STRIPE_SECRET_KEY=
STRIPE_PUBLISHABLE_KEY=

# AWS

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_STORAGE_BUCKET_NAME=

You can then run the image like this:

docker run --env-file .env -d <image-name>

探索相关项目

加载中…