Welcome to AI Video Boilerplate Pro! A free template to run scalable, cheap AI websites.
Hosted on Heroku for a live demo here: https://proAI.darefail.com
A single VPS running this codebase has so far proven to handle over 10,000 concurrent users, 1,000,000 views and 50 websites without issue.
RateLoaf.com - Rate how well cats sit like bread with OpenAI GPT4v, Roboflow workflows, and images uploaded to Amazon S3 in a celery task.
HandLand.lol - Create live AI multiplayer games using WebRTC, Websockets, and Roboflow for AI vision models.
AI Video Boilerplate Simple (quick frontend apps): https://github.com/DareFail/AI-Video-Boilerplate-Simple/
AI Video Boilerplate for Chrome Extensions: https://github.com/DareFail/AI-Video-Boilerplate-Chrome/
- Frontend: minimal HTML and javascript, roll your own
- Backend: Django, Docker, Postgres Database, Redis caching, Celery background tasks, Celery Beat scheduled tasks Django
- Preconfigured Libraries: Django Allauth authentication, AWS storage, Slack alerts and slack bots, Twilio texting, Sendgrid Email, Captcha spam detection, Sesame Magic Link passwordless signin, Hijack user impersonation
- Multiplayer: WebRTC and native Websockets with daphne and channels
- AI: Integrated with Roboflow (sponsored project), includes Stable diffusion, Flux, Roboflow installed.
- Scalable and Cheap to Host: Run hundreds of websites and millions of users into a heroku, digital ocean, or a VPS of your choice
This is a template for putting multiple django websites into a single codebase that can be deployed to any VPS for cheap. It is full of full deployed projects and templates for you to copy and modify.
- XXXXX_basic - Simple django webpage with shared components like favicons, navigation bar, footer, etc
- XXXXX_signedin - Flexible User to Group Sign up flow with django allauth, with teams, administrators, invitations, changing passwords, magic links, and a backend dashboard
- XXXXX_websockets - Live multiplayer django apps. This is a chatroom example.
-
Clone the repo
git clone https://github.com/darefail/AI-Video-Boilerplate-Pro.git cd AI-Video-Boilerplate-Pro
-
Install Docker The easiest way to get up and running is with Docker.
Just install Docker and Docker Compose and then run:
-
Create .env Copy .env.example and rename the file .env Fill out the uncommented values Uncomment and fill out the other values if you want to use them
-
Build the container and run locally
docker compose up docker compose exec web python manage.py makemigrations docker compose exec web python manage.py migrate
-
Go to localhost:8000
-
Make a superuser (optional)
docker compose exec web python manage.py createsuperuser
Check everything works by going to localhost:8000/admin and logging in
On a Mac: fn + f1
Dev Containers Reopen in Container
docker compose up
docker compose exec web python manage.py makemigrations
docker compose exec web python manage.py migrate
# sometimes have to run
docker compose exec web python manage.py makemigrations [app name]
docker compose exec web pip3 install --upgrade pip-tools
docker compose exec web pip3 install --upgrade pip setuptools wheel twine check-wheel-contents
docker compose exec web pip-compile requirements.in
docker compose build
docker compose up
# Simple python formatting
black .
# Python errors
flake8 .
# Django Templates / Javascript / HTML
djlint .
# Django Templates / Javascript / HTML formatting
djlint . --reformat
- Sign up or log in to Vercel.
- Create a new project from the Vercel dashboard.
- Connect your GitHub repository.
- Click "Deploy".
- Sign up or log in to Heroku.
- Create a new app from the Heroku dashboard.
- Fill out all the environment variables from .env.
In production:
DJANGO_SETTINGS_MODULE=main.settings.heroku
-
Add Heroku Data for Redis and Heroku Postgres in the Add-ons
-
Connect your GitHub repository.
-
Click "Deploy Branch".
-
Set the heroku settings
heroku stack:set container
heroku run python manage.py createsuperuser
-
Under settings, Configure SSL and set to Automatic Certificate Management (ACM)
-
If an external domain and using cloudflare, point to heroku and change the SSL to Full
(If you don't, the url will have an infinite redirect)
app_directory = 'XXXXX'
XxxxxConfig
name = XXXXX
'XXXXX.apps.XxxxxConfig',
docker compose exec web python manage.py makemigrations XXXXX
docker compose exec web python manage.py migrate
9. Add new logo files from https://realfavicongenerator.net into static/favicons
XXXXX.com
XXXXX.urls
(If you don't, the url will have an infinite redirect)
Pre commit hooks for linters is not working
pre-commit install
Ignore precommmit hook
git commit --no-verify -m ""
List all docker containers
docker ps
Log into docker database
docker exec -it main-db-1 psql -U postgres
Inside database - (\l show schema, \c connect to schema, \dt list all tables)
\l
\c main
\dt
Run Python in Heroku Shell
heroku run python
#when loaded
import django
django.setup()
Useful repeatable code changer
https://pinetools.com/add-text-each-line
Static files not found
docker compose exec web python manage.py collectstatic
Thanks to Roboflow for sponsoring this project. Get your free API key at: Roboflow
Distributed under the APACHE 2.0 License. See LICENSE
for more information.
Twitter: @darefailed
Youtube: How to Video coming soon
Project Link: https://github.com/darefail/AI-Video-Boilerplate-Pro