https://github.com/dotja/django-example
Django project with various example apps.
https://github.com/dotja/django-example
celery custom-user-model django photo-editing stripe-payments
Last synced: 2 months ago
JSON representation
Django project with various example apps.
- Host: GitHub
- URL: https://github.com/dotja/django-example
- Owner: dotja
- Created: 2022-11-11T14:58:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-28T11:12:06.000Z (about 2 years ago)
- Last Synced: 2024-10-11T07:11:49.524Z (6 months ago)
- Topics: celery, custom-user-model, django, photo-editing, stripe-payments
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 41
- Watchers: 3
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- stars - dotja/django-example - Django project with various example apps. (Python)
- stars - dotja/django-example - Django project with various example apps. (Python)
README
# Django examples
A Django project with example apps.
This repo will be updated when new apps are added to it.
The current list of apps include:
1. app_users
An app to demonstrate using a custom user model in Django.2. user_payment
An app to receive user payments through Stripe.3. edit_photo
An app that converts JPEG images into sketch using Celery.4. flashcards
An app that uses MongoDB to store flashcards.## Running this project
* start by installing the requirements:
```
pip install --upgrade pip
pip install -r requirements.txt
```* the following environment variables need to be exported prior to use:
```
export SECRET_KEY='your django secret key'export STRIPE_PUBLIC_KEY_TEST='pk_test_12345...'
export STRIPE_SECRET_KEY_TEST='sk_test_12345...'
export STRIPE_WEBHOOK_SECRET_TEST='whsec_12345..'
export PRODUCT_PRICE='price_12345...'export MONGO_USER='user'
export MONGO_PASSWORD='password'
export MONGO_HOST='0.0.0.0'
export MONGO_DB='flashcard_db'
export MONGO_COLLECTION='cards'
```* to run the photo editing app you need to have rabbitmq and a Celery worker running as follows:
```
## run the rabbitmq docker container
docker run -d -p 5672:5672 rabbitmq## start the Celery worker
cd django-example
celery -A django_examples worker --loglevel=INFO
```* to run the flashcards app you need to have a mongodb container running:
```
docker run --rm -d -p 27017:27017 --name mongodb -v 001_initial.js:/docker-entrypoint-initdb.d/001_initial.js:ro -v mongodb:/data/db -e MONGO_INITDB_DATABASE=flashcard_db mongo --auth
```* after that you can run the following:
```
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
```