This guide walks you through setting up a Django project, creating a Django app, and deploying it using Zappa.
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
Follow the Django tutorial to create a project and app:
django-admin startproject project_backend
python manage.py startapp project_domain
Create a .env
file in the project root and configure your environment variables.
In the settings.py
file of your Django project (project_backend
), comment out the databases snippet to prevent issues during development.
# project_backend/settings.py
# ...
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': BASE_DIR / "db.sqlite3",
# }
# }
# ...
Define your URL patterns in the urls.py
file of your Django app (project_domain
). Here's a simple example:
# project_domain/urls.py
from django.urls import path
from .views import HomePageView
urlpatterns = [
path('', HomePageView.as_view(), name='home'),
# Add more URL patterns as needed
]
Set up your models in the models.py
file of your Django app (project_domain
).
python manage.py runserver
Visit http://127.0.0.1:8000/ to see your development server in action.
pip install zappa
zappa init
Follow the prompts to configure your Zappa settings.
zappa deploy dev
zappa update dev
zappa undeploy dev
This README provides a basic outline. Customize it based on your project specifics and add more sections as needed.
This addition guides users on defining URLs in the urls.py
file before defining models in the Django app. Adjust the instructions as needed for your specific project structure and requirements.
- PynamoDB Link (https://pynamodb.readthedocs.io/en/stable/quickstart.html)
- Zappa Django Guide by edgarroman (https://romandc.com/zappa-django-guide/)
- Django Rest Framework (https://www.django-rest-framework.org/)
- Django Setup (https://docs.djangoproject.com/en/5.0/intro/tutorial01/)