Beginner
What is Django and what are its main features?
Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Its main features include an ORM (Object-Relational Mapping), an admin interface, and a robust authentication system.
To start using Django, follow these steps:
- Install Django:
pip install django
- Create a project:
django-admin startproject myproject
- Run the development server:
python manage.py runserver
For example, to create a simple model in Django, you could use:
from django.db import models
class Post(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()