Skip to main content

A Django starter script with both Chinese and English versions, auto versioning via setuptools_scm.

Project description

Contributors Forks Stargazers Issues Unlicense License LinkedIn

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, Pillow, and now also django-jazzmin 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). The avatar field is intentionally omitted to avoid conflicts with django-avatar.
  • 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.

Distribution & CI/CD

Our CI/CD pipeline publishes snapshot releases to TestPyPI and official releases to PyPI. This means you can always grab the latest snapshot for testing or the stable release for production use!

CLI Quick Start

For an even quicker start, install the package via pip and use the CLI entry points:

  • English CLI:
    django-starter-en = "django_user_starter.cli:main_en"
  • 中文 CLI:
    django-starter-zh = "django_user_starter.cli:main_zh"

To launch the English version, simply run:

django-starter-en

中文版 快速启动🚀🚀🚀

django-starter-zh

Prerequisites

Python3: Ensure Python3 is installed on your system.

Bash: The scripts are designed 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.

Test Snapshot

To have a snapshot version to test, you can deploy to dev branch, and install snapshot version with following:

pip install -i https://test.pypi.org/simple/ django-user-starter==0.0.1.post17 --extra-index-url https://pypi.org/simple django-user-starter

Note: Please update the version above in your terminal execution to ensure test with the latest snapshot version.

Local Build

pip install --upgrade pip
pip install build
python3 -m build

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_user_starter-0.0.1.post19.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_user_starter-0.0.1.post19-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file django_user_starter-0.0.1.post19.tar.gz.

File metadata

File hashes

Hashes for django_user_starter-0.0.1.post19.tar.gz
Algorithm Hash digest
SHA256 1f9f60ed7cb8acd19728baf702b8ee4c6edf425898d51711a060e7c69eee396d
MD5 2fcbeb990d50472cadfbf7048e964e42
BLAKE2b-256 ecc5ef2eb794984767bf02ac175ce62f3190305f83b09bddb1d7f481ca6bbf8b

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_user_starter-0.0.1.post19.tar.gz:

Publisher: deploy.yml on yaninsanity/django-user-starter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_user_starter-0.0.1.post19-py3-none-any.whl.

File metadata

File hashes

Hashes for django_user_starter-0.0.1.post19-py3-none-any.whl
Algorithm Hash digest
SHA256 04ff9aedcef56abbd028f4f6e2f1d2271f360d2e70288d07f6df9e8f02d36915
MD5 177ea165ea8efacb08f5715f36df4a5d
BLAKE2b-256 7bf603f4c08bbd7acc7b0ee6a8dc8a7692cae69b2fe4fe4e2c11b8a001cb4ee8

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_user_starter-0.0.1.post19-py3-none-any.whl:

Publisher: deploy.yml on yaninsanity/django-user-starter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page