Learn how to build AI-driven websites with the Django web framework and monetize your services
OpenAI API & Replicate APIYou will learn how to integrate AI features into your app using the OpenAI and Replicate APIs.
MonetizationThe book provides step-by-step instructions on setting up Stripe, processing payments and handling subscriptions.
DeploymentThe reader will learn a cost-effective method to put the website online and serve it efficiently.
Django FundamentalsThe book covers all Django essentials, such as project setup, templates, models, static files, authentication, images, routing, and database interactions. You will gain a strong foundation for building any kind of web application with Django.
About DjangoDjango is a Python web framework that comes with built-in tools for common tasks such as database interactions, URL routing, and template handling. It's a great choice for building secure web apps.
Compared to more minimalistic web frameworks such as Flask or Express.js, Django provides a higher level of abstraction and includes more features out of the box.
Python is a friendly programming language that has a simple and intuitive syntax. Its extensive standard library and third-party packages make it highly useful for various tasks, including web development.
About the AuthorSamuli Natri is an entrepreneur with over two decades of experience in software engineering. He studied computer science at the Helsinki University of Technology.
Contents Hello, WorldHow to create a virtual environment with venv and start a new Django project.
Core AppHow to set up the project's main app.
TemplatesHow to serve dynamic content using templates and use a "base" template for header and footer elements.
ModelsHow to use Django's built-in database abstraction layer.
Home PageHow to use class-based views to handle requests and responses.
Static FilesHow to serve static files during development, such as CSS, JavaScript, and image assets.
StylingHow to use Sass, mixins, and media queries to create a responsive design.
Environment VariablesHow to use environment variables for storing sensitive data.
AuthenticationHow to add authentication using django-allauth.
Authentication With GoogleHow to add a "Login with Google" button.
MessagesHow to use cookies to display temporary messages.
EmailsHow to use SendGrid to send emails.
Extending The User ModelHow to store additional information for each user using an extra Profile model.
OpenAI APIHow to generate text using the OpenAI API.
ImagesHow to upload images, create thumbnails, and serve them.
Replicate APIHow to use a cloud-based machine learning model (Stable Diffusion) to generate images.
Stripe SubscriptionsHow to enable monthly payments.
RequirementsHow to freeze package versions for deployment.
DeploymentHow to manually deploy the app to Hetzner (Nginx, PostgreSQL, Gunicorn & SSL).