Git Product home page Git Product logo

cookiecutter-django's Introduction

Starter Template for Python Django projects

Use this cookiecutter template ๐Ÿช to start every new Python Django project.

System Dependencies

Getting Started

Create a new Python Django project

cookiecutter gh:papamana/cookiecutter-django

Create a new Python Django Project with Spesific Release version

cookiecutter gh:papamana/cookiecutter-django --checkout <release version>

example:

cookiecutter gh:papamana/cookiecutter-django --checkout v0.1-beta.1

For Windows, you might need to run python -m cookiecutter as the command might not work even though it's correctly configured on the PATH.

What's inside

The template covers your back with the following elements:

  • README.md with a pre-defined structure.
  • CHANGELOG.md file with an initial message.
  • Stub project template.
  • Test directory with a sample test file.
  • GitHub workflow configuration to run pytest automatically.
  • Pre-configured mypy, Flake8, isort.
  • A set of pre-commit hooks.
  • pyproject.toml for Poetry.

How to use it

Before creating a project:

  • Install Poetry.
  • Install pre-commit.
  • Choose a project name. Likely, in the format foo-bar and create a GitHub repository for it. The root package of your project will have a default name foo_bar. Make sure that you made the repository private if you plan to create a private (non-open-source) project.
  • Choose the license. For public projects, use MIT. For private projects, use "Proprietary."

The project generation runs these steps:

  • Creates a new project from the template.
  • Initializes a GitHub repository.
  • Installs pre-commit hooks and updates all hooks to their latest versions.
  • Create an initial commit.

After creating a project:

  • Initialize the virtual environment and install all dependencies with poetry install.
  • Deploy changes to GitHub.
  • For Windows, you might need to change your access token to GitHub. See information here

Other hints:

Tests with GitHub actions

A file .github/workflows/tests.yml is responsible for running tests on GitHub.

How to configure VSCode

At the moment, VSCode doesn't automatically detect Poetry environments. You can set it manually, though. For a newly created project, create a .vscode/settings.json

poetry install
mkdir -p .vscode
cat <<EOF > .vscode/settings.json
{
  "python.pythonPath": "$(poetry env info -p)/bin/python"
}
EOF

Ref: microsoft/vscode-python#8372

Using .env with VSCode

If you use VSCode and the vscode-dotenv extension, add the following lines to your .vscode/settings.json file:

"files.associations": {
  "env.example": "dotenv",
  "env.github-actions": "dotenv"
}

How to contribute

  • If you have questions, ideas or suggestions, write them down in an issue.
  • If you have a fix or an enhancement, create a pull request.

REFERENCE PROJECT

cookiecutter-django's People

Contributors

davidfishlock avatar imankulov avatar jankratochvilcz avatar juandisay avatar

Watchers

 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.