Skip to content

Commit ef759da

Browse files
committed
Add materials for django setup tutorial
1 parent 682378f commit ef759da

File tree

16 files changed

+270
-0
lines changed

16 files changed

+270
-0
lines changed

create-django-project/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# How to Create a Django Project
2+
3+
Follow tutorial on [How to Create a Django Project](https://realpython.com/django-setup/) on Real Python to create a new Django project with one Django app from scratch.
4+
5+
> **Note:** This project targets Python 3.10 or later.
6+
7+
## Setup
8+
9+
You can run the provided example project on your local machine by following the steps outlined below.
10+
11+
Create a new virtual environment:
12+
13+
```bash
14+
$ python3 -m venv venv
15+
```
16+
17+
Activate the virtual environment:
18+
19+
```bash
20+
$ source venv/bin/activate
21+
```
22+
23+
Install the dependencies for this project:
24+
25+
```bash
26+
(venv) $ python -m pip install -r requirements.txt
27+
```
28+
29+
## Run the Scaffold
30+
31+
Navigate into the Django project folder:
32+
33+
```bash
34+
(venv) $ cd setup
35+
```
36+
37+
Run the Django development server:
38+
39+
```bash
40+
(venv) $ python manage.py runserver
41+
```
42+
43+
Navigate to `http://localhost:8000/` to see the starter project in action.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[project]
2+
name = "django-setup"
3+
version = "0.1.0"
4+
requires-python = ">=3.10"
5+
dependencies = [
6+
"django>=5.2.8",
7+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
asgiref==3.11.0
2+
django==5.2.8
3+
sqlparse==0.5.3

create-django-project/setup/example/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ExampleConfig(AppConfig):
5+
default_auto_field = "django.db.models.BigAutoField"
6+
name = "example"

create-django-project/setup/example/migrations/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.shortcuts import render
2+
3+
# Create your views here.

0 commit comments

Comments
 (0)