Skip to content

Commit d387c64

Browse files
Create django project (#722)
* Add materials for django setup tutorial * Add noqa to scaffolding for CI * Format scaffolding * Update to Django 6 * Fix with ruff * Final QA --------- Co-authored-by: Bartosz Zaczyński <[email protected]>
1 parent 779f6d2 commit d387c64

File tree

16 files changed

+267
-0
lines changed

16 files changed

+267
-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.12 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.12"
5+
dependencies = [
6+
"django>=6.0",
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==6.0
3+
sqlparse==0.5.4

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 # noqa: F401
2+
3+
# Register your models here.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ExampleConfig(AppConfig):
5+
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 # noqa: F401
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 # noqa: F401
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 # noqa: F401
2+
3+
# Create your views here.

0 commit comments

Comments
 (0)