GithubHelp home page GithubHelp logo

poteznykrolik / django-hatch-startproject Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oliverandrich/django-hatch-startproject

0.0 0.0 0.0 524 KB

Django startproject template that uses hatch for project management.

License: MIT License

Python 91.02% HTML 8.98%

django-hatch-startproject's Introduction

django-hatch-startproject

Screenshot of the landing page

I took the inspiration from Jeff Triplett's django-startproject and created my own starter for a fresh django project. It includes the batteries I use regularly. ๐Ÿคทโ€โ™‚๏ธ

The template is also inspired by Carlton Gibson's Post The Single Folder Django Project Layout. It uses the single folder layout as a start as I always run in the same situation Carlton describes in his post. If you have to split the project into several apps, you can always call python manage.py startapp later on.

Out of the box SQLite is configured, but you can easily activate MySQL or Postgres support by turning on the corresponding features in the pyproject.toml file.

Features

Development tools

  • django-types
  • model-bakery
  • pytest
  • pytest-cov
  • pytest-django
  • pytest-mock
  • pre-commit setup inspired by Boost your Django DX
  • sane ruff configuration
  • syrupy for snapshot testing

Install

django-admin startproject \
    --extension=ini,py,toml,yaml,yml \
    --template=https://github.com/oliverandrich/django-hatch-startproject/archive/main.zip \
    example_project

# Setup environment
cd example_project
echo "DJANGO_DEBUG=True" >> .env
echo "SECRET_KEY=notsosecret" >> .env

# Install dependencies
hatch env create

# Migrate database
hatch run migrate

# Start dev server
hatch run runserver

Add Postgres support

To activate Postgres support edit the pyproject.toml and change the default environment to look like the following snippet.

# Default environment
[tool.hatch.envs.default]
dependencies = ["django-types", "ipdb", "model-bakery"]
features = [
  # Uncomment the next line to add the MySQL dependencies
  # "mysql",
  # Uncomment the next line to add the Postgres dependencies
  "postgres",
]

Set the environment variable DATABASE_URL to something reasonable

Add MySQL support

To activate Postgres support edit the pyproject.toml and change the default environment to look like the following snippet.

# Default environment
[tool.hatch.envs.default]
dependencies = ["django-types", "ipdb", "model-bakery"]
features = [
  # Uncomment the next line to add the MySQL dependencies
  "mysql",
  # Uncomment the next line to add the Postgres dependencies
  # "postgres",
]

Set the environment variable DATABASE_URL to something reasonable

Contributing

Contributions, issues and feature requests are welcome! Feel free to check issues page.

django-hatch-startproject's People

Contributors

oliverandrich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.