A Django starter script with both Chinese and English versions, auto versioning via setuptools_scm.
Project description
Project Detail
This repository contains two shell scripts (starter-en.sh && starter-zh.sh) that automates the setup of a Django project with a custom user system and integrates django-avatar for avatar management. The script is designed to simplify the process of creating a Django project with common configurations, including user authentication, avatar management, and basic templates.
Features
-
Python3 Check: Ensures Python3 is installed before proceeding.
-
Virtual Environment: Creates and activates a virtual environment.
-
Dependencies Installation: Installs Django, django-avatar, and Pillow via requirements.txt.
-
Interactive Setup: Prompts for project and app names.
-
Custom User Model: Optionally creates a custom user model with additional fields (bio, birth_date, phone, address, role).
-
Admin Configuration: Configures the Django admin to support the custom user model.
-
Basic Views and Templates: Generates login, logout, register, and homepage views with corresponding templates.
-
URL Configuration: Sets up URL routing for the admin, avatar, and user app.
-
Database Migrations: Runs initial database migrations.
-
Superuser Creation: Optionally creates a superuser for the Django admin.
-
Prerequisites Python3: Ensure Python3 is installed on your system.
-
Bash: The script is written for Unix-like systems (Linux, macOS).
Getting Started
Clone the Repository:
git clone https://github.com/yaninsanity/django-user-starter
cd django-user-starter
Make the Script Executable:
chmod +x starter-en.sh
# Run the Script, run with English Prompt
sh starter-en.sh
# run with Chinese prompt:
chmod +x starter-en.sh
sh starter-zh.sh
Follow the Prompt Flow
Enter the virtual environment directory name (default: venv).
Enter the Django project name (default: myproject).
Enter the user system app name (default: users).
Choose whether to create a custom user model (default: y).
Optionally create a superuser (default: y).
Start the Development Server:
source venv/bin/activate
python3 <myproject>/manage.py runserver
Access the Project:
Admin Panel: http://localhost:8000/admin/
Homepage: http://localhost:8000/
Login Page: http://localhost:8000/users/login/
Register Page: http://localhost:8000/users/register/
Custom User Model
If you choose to create a custom user model, the script will generate a CustomUser model with the following fields:
bio: A text field for the user's biography.
birth_date: A date field for the user's birth date.
phone: A character field for the user's phone number.
address: A text field for the user's address.
role: A character field for the user's role (e.g., admin, editor).
The avatar field is intentionally omitted to avoid conflicts with django-avatar.
Templates
The script generates the following templates:
Login Template: users/templates/users/login.html
Register Template: users/templates/users/register.html
Homepage Template: templates/home.html
These templates are basic and can be customized further as needed.
Media Files
The script configures MEDIA_URL and MEDIA_ROOT in settings.py to handle media files, which are required by django-avatar for avatar management.
Contributing
If you would like to contribute to this project, please fork the repository and submit a pull request. Any contributions, whether bug fixes, feature additions, or documentation improvements, are welcome.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_user_starter-0.0.1.post12.tar.gz.
File metadata
- Download URL: django_user_starter-0.0.1.post12.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1c58d065fe1713b39711851d650b8c5c80237ab8ec841fa46265eff507c112f
|
|
| MD5 |
b1f37d1cf423c6bedbd7313832d01314
|
|
| BLAKE2b-256 |
da642ee0f9bcdaa244b8972482d223e22505b27401d5b3411598427aac8825b1
|
Provenance
The following attestation bundles were made for django_user_starter-0.0.1.post12.tar.gz:
Publisher:
deploy.yml on yaninsanity/django-user-starter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_user_starter-0.0.1.post12.tar.gz -
Subject digest:
b1c58d065fe1713b39711851d650b8c5c80237ab8ec841fa46265eff507c112f - Sigstore transparency entry: 182700088
- Sigstore integration time:
-
Permalink:
yaninsanity/django-user-starter@d93131708d339a482fd095ee08667b73d43be22d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/yaninsanity
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@d93131708d339a482fd095ee08667b73d43be22d -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_user_starter-0.0.1.post12-py3-none-any.whl.
File metadata
- Download URL: django_user_starter-0.0.1.post12-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5f81fa592a9dd8d18f11c34e8a865553e280f866ae419fc7376bb512d7181d5
|
|
| MD5 |
6815a78890eb118d21bc548d9144b67f
|
|
| BLAKE2b-256 |
819bf6f6faa5e8465e837d4de820e2597602acc4b91bf628c7f615c0a4a658c1
|
Provenance
The following attestation bundles were made for django_user_starter-0.0.1.post12-py3-none-any.whl:
Publisher:
deploy.yml on yaninsanity/django-user-starter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_user_starter-0.0.1.post12-py3-none-any.whl -
Subject digest:
a5f81fa592a9dd8d18f11c34e8a865553e280f866ae419fc7376bb512d7181d5 - Sigstore transparency entry: 182700089
- Sigstore integration time:
-
Permalink:
yaninsanity/django-user-starter@d93131708d339a482fd095ee08667b73d43be22d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/yaninsanity
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@d93131708d339a482fd095ee08667b73d43be22d -
Trigger Event:
push
-
Statement type: