A personal blog for one of my clients powered by Django and Next.js.
- Backend
- Authentication and models with Django
- API with Django Rest Framework
- Content editor from TinyMCE
- Database from SQLite
- Frontend
- Static site generated by Next.js
- Styling inspired by Every Layout
- RSS feed
- Deployment
- Nginx reverse proxy serving static files with Whitenoise
- Media files stored in AWS S3 with the help of django-storages
- Gunicorn and self-hosted
next start
running as systemd services on an AWS EC2 Ubuntu instance
Django speaks to our database to store blog post and admin user data.
Next.js asks Django for our posts through two main function in our page component:
getStaticPaths()
to define each individual blog postgetStaticProps()
to populate the data for each blog post
The name of the file tells Next.js how to form the blog post URLs, i.e., [slug].tsx
means use the slug
to get our final paths. Hence, "get static paths."
- Pull the new code to the server
- Migrate database changes with
python manage.py migrate
- Collect static files with
python manage.py collectstatic
- Restart gunicorn service
- Build the new code with
npm run build
- Restart the Next.js server with
npm run start