Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Overview

Cookiecutter Django

Build Status Documentation Status Updates https://img.shields.io/badge/cookiecutter-Join%20on%20Slack-green?style=flat&logo=slack Code Helpers Badge Code style: black

Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Features

  • For Django 3.1
  • Works with Python 3.9
  • Renders Django projects with 100% starting test coverage
  • Twitter Bootstrap v4 (maintained Foundation fork also available)
  • 12-Factor based settings via django-environ
  • Secure by default. We believe in SSL.
  • Optimized development and production settings
  • Registration via django-allauth
  • Comes with custom user model ready to go
  • Optional basic ASGI setup for Websockets
  • Optional custom static build using Gulp and livereload
  • Send emails via Anymail (using Mailgun by default or Amazon SES if AWS is selected cloud provider, but switchable)
  • Media storage using Amazon S3 or Google Cloud Storage
  • Docker support using docker-compose for development and production (using Traefik with LetsEncrypt support)
  • Procfile for deploying to Heroku
  • Instructions for deploying to PythonAnywhere
  • Run tests with unittest or pytest
  • Customizable PostgreSQL version
  • Default integration with pre-commit for identifying simple issues before submission to code review

Optional Integrations

These features can be enabled during initial project setup.

  • Serve static files from Amazon S3, Google Cloud Storage or Whitenoise
  • Configuration for Celery and Flower (the latter in Docker setup only)
  • Integration with MailHog for local email testing
  • Integration with Sentry for error logging

Constraints

  • Only maintained 3rd party libraries are used.
  • Uses PostgreSQL everywhere (10.16 - 13.2)
  • Environment variables for configuration (This won't work with Apache/mod_wsgi).

Support this Project!

This project is run by volunteers. Please support them in their efforts to maintain and improve Cookiecutter Django:

  • Daniel Roy Greenfeld, Project Lead (GitHub, Patreon): expertise in Django and AWS ELB.
  • Nikita Shupeyko, Core Developer (GitHub): expertise in Python/Django, hands-on DevOps and frontend experience.

Projects that provide financial support to the maintainers:


Two Scoops of Django

Two Scoops of Django 3.x is the best ice cream-themed Django reference in the universe!

pyup

pyup

Pyup brings you automated security and dependency updates used by Google and other organizations. Free for open source projects!

Usage

Let's pretend you want to create a Django project called "redditclone". Rather than using startproject and then editing the results to include your name, email, and various configuration issues that always get forgotten until the worst possible moment, get cookiecutter to do all the work.

First, get Cookiecutter. Trust me, it's awesome:

$ pip install "cookiecutter>=1.7.0"

Now run it against this repo:

$ cookiecutter https://github.com/pydanny/cookiecutter-django

You'll be prompted for some values. Provide them, then a Django project will be created for you.

Warning: After this point, change 'Daniel Greenfeld', 'pydanny', etc to your own information.

Answer the prompts with your own desired options. For example:

Cloning into 'cookiecutter-django'...
remote: Counting objects: 550, done.
remote: Compressing objects: 100% (310/310), done.
remote: Total 550 (delta 283), reused 479 (delta 222)
Receiving objects: 100% (550/550), 127.66 KiB | 58 KiB/s, done.
Resolving deltas: 100% (283/283), done.
project_name [Project Name]: Reddit Clone
project_slug [reddit_clone]: reddit
author_name [Daniel Roy Greenfeld]: Daniel Greenfeld
email [[email protected]]: [email protected]
description [Behold My Awesome Project!]: A reddit clone.
domain_name [example.com]: myreddit.com
version [0.1.0]: 0.0.1
timezone [UTC]: America/Los_Angeles
use_whitenoise [n]: n
use_celery [n]: y
use_mailhog [n]: n
use_sentry [n]: y
use_pycharm [n]: y
windows [n]: n
use_docker [n]: n
use_heroku [n]: y
use_compressor [n]: y
Select postgresql_version:
1 - 13.2
2 - 12.6
3 - 11.11
4 - 10.16
Choose from 1, 2, 3, 4, 5 [1]: 1
Select js_task_runner:
1 - None
2 - Gulp
Choose from 1, 2 [1]: 1
Select cloud_provider:
1 - AWS
2 - GCP
3 - None
Choose from 1, 2, 3 [1]: 1
custom_bootstrap_compilation [n]: n
Select open_source_license:
1 - MIT
2 - BSD
3 - GPLv3
4 - Apache Software License 2.0
5 - Not open source
Choose from 1, 2, 3, 4, 5 [1]: 1
keep_local_envs_in_vcs [y]: y
debug[n]: n

Enter the project and take a look around:

$ cd reddit/
$ ls

Create a git repo and push it there:

$ git init
$ git add .
$ git commit -m "first awesome commit"
$ git remote add origin [email protected]:pydanny/redditclone.git
$ git push -u origin master

Now take a look at your repo. Don't forget to carefully look at the generated README. Awesome, right?

For local development, see the following:

Community

  • Have questions? Before you ask questions anywhere else, please post your question on Stack Overflow under the cookiecutter-django tag. We check there periodically for questions.
  • If you think you found a bug or want to request a feature, please open an issue.
  • For anything else, you can chat with us on Slack.

For Readers of Two Scoops of Django

You may notice that some elements of this project do not exactly match what we describe in chapter 3. The reason for that is this project, amongst other things, serves as a test bed for trying out new ideas and concepts. Sometimes they work, sometimes they don't, but the end result is that it won't necessarily match precisely what is described in the book I co-authored.

For pyup.io Users

If you are using pyup.io to keep your dependencies updated and secure, use the code cookiecutter during checkout to get 15% off every month.

"Your Stuff"

Scattered throughout the Python and HTML of this project are places marked with "your stuff". This is where third-party libraries are to be integrated with your project.

Releases

Need a stable release? You can find them at https://github.com/pydanny/cookiecutter-django/releases

Not Exactly What You Want?

This is what I want. It might not be what you want. Don't worry, you have options:

Fork This

If you have differences in your preferred setup, I encourage you to fork this to create your own version. Once you have your fork working, let me know and I'll add it to a 'Similar Cookiecutter Templates' list here. It's up to you whether or not to rename your fork.

If you do rename your fork, I encourage you to submit it to the following places:

  • cookiecutter so it gets listed in the README as a template.
  • The cookiecutter grid on Django Packages.

Submit a Pull Request

We accept pull requests if they're small, atomic, and make our own project development experience better.

Articles

Have a blog or online publication? Write about your cookiecutter-django tips and tricks, then send us a pull request with the link.

Code of Conduct

Everyone interacting in the Cookiecutter project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.

Comments
  • Update to Django 1.11

    Update to Django 1.11

    I've told the bot to stay on 1.10.x for now (https://github.com/pydanny/cookiecutter-django/commit/f62e05b95e60c043cb463c66b40ca69c1f2d9c26) and merged the latest security release.

    I believe @luzfcb was working on a release checklist. Let's put this here.

    opened by jayfk 49
  • Local Docker: python: can't open file 'manage.py': [Errno 2] No such file or directory

    Local Docker: python: can't open file 'manage.py': [Errno 2] No such file or directory

    What happened?

    I get this error message python: can't open file 'manage.py': [Errno 2] No such file or directory after running the following commands:

    docker-compose -f local.yml build
    docker-compose -f local.yml up -d
    

    What should've happened instead?

    Django should have been running on my local docker-machine

    Steps to reproduce

    
    # cookiecutter https://github.com/pydanny/cookiecutter-django
    You've downloaded C:\Users\ph\.cookiecutters\cookiecutter-django before. Is it okay to delete and re-download it? [yes]: yes
    project_name [My Awesome Project]: mytestproject.nu
    project_slug [mytestproject_nu]:
    description [Behold My Awesome Project!]: My Test Project
    author_name [Daniel Roy Greenfeld]: Philip
    domain_name [example.com]: mytestproject.nu
    email [[email protected]]: [email protected]
    version [0.1.0]:
    Select open_source_license:
    Choose from 1, 2, 3, 4, 5 [1]: 1
    timezone [UTC]: Europe/Copenhagen
    windows [n]: y
    use_pycharm [n]: y
    use_docker [n]: y
    Select postgresql_version:
    Choose from 1, 2, 3, 4, 5, 6, 7, 8 [1]: 1
    Select js_task_runner:
    Choose from 1, 2 [1]: 1
    Select cloud_provider:
    Choose from 1, 2 [1]: 2
    custom_bootstrap_compilation [n]: n
    use_compressor [n]: y
    use_celery [n]: y
    use_mailhog [n]: y
    use_sentry [n]: y
    use_whitenoise [n]: n
    use_heroku [n]: n
    use_travisci [n]: n
    keep_local_envs_in_vcs [y]: y
    debug [n]: n
     [SUCCESS]: Project initialized, keep up the good work!
    

    docker-compose -f local.yml build docker-compose -f local.yml up -d

    # docker-machine --version
    Docker-machine version 0.16.1, build cce350d7
    
    # docker --version
    Docker version 18.09.2, build 6247962
    

    Microsoft Windows 10 Pro Version 10.0.17134 Build 17134

    # docker-compose -f local.yml logs
     Attaching to mytestproject_nu_celeryworker_1, mytestproject_nu_django_1, mytestproject_nu_flower_1, mytestproject_nu_celerybeat_1, mytestproject_nu_postgres_1, mytestproject_nu_mailhog_1, mytestproject_nu_redis_1
    celeryworker_1  | Waiting for PostgreSQL to become available...
    celeryworker_1  | Waiting for PostgreSQL to become available...
    celeryworker_1  | PostgreSQL is available
    celeryworker_1  | Error:
    celeryworker_1  | Unable to load celery application.
    celeryworker_1  | The module config was not found.
    celeryworker_1  |
    django_1        | Waiting for PostgreSQL to become available...
    postgres_1      | The files belonging to this database system will be owned by user "postgres".
    postgres_1      | This user must also own the server process.
    postgres_1      |
    django_1        | Waiting for PostgreSQL to become available...
    postgres_1      | The database cluster will be initialized with locale "en_US.utf8".
    django_1        | PostgreSQL is available
    postgres_1      | The default database encoding has accordingly been set to "UTF8".
    postgres_1      | The default text search configuration will be set to "english".
    postgres_1      |
    postgres_1      | Data page checksums are disabled.
    postgres_1      |
    postgres_1      | fixing permissions on existing directory /var/lib/postgresql/data ... ok
    postgres_1      | creating subdirectories ... ok
    postgres_1      | selecting default max_connections ... 100
    postgres_1      | selecting default shared_buffers ... 128MB
    postgres_1      | selecting dynamic shared memory implementation ... posix
    postgres_1      | creating configuration files ... ok
    postgres_1      | running bootstrap script ... ok
    postgres_1      | performing post-bootstrap initialization ... ok
    postgres_1      | syncing data to disk ... ok
    postgres_1      |
    postgres_1      | WARNING: enabling "trust" authentication for local connections
    django_1        | python: can't open file 'manage.py': [Errno 2] No such file or directory
    postgres_1      | You can change this by editing pg_hba.conf or using the option -A, or
    postgres_1      | --auth-local and --auth-host, the next time you run initdb.
    postgres_1      |
    postgres_1      | Success. You can now start the database server using:
    postgres_1      |
    postgres_1      |     pg_ctl -D /var/lib/postgresql/data -l logfile start
    postgres_1      |
    postgres_1      | waiting for server to start....2019-05-19 09:32:59.577 UTC [40] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
    postgres_1      | 2019-05-19 09:32:59.596 UTC [41] LOG:  database system was shut down at 2019-05-19 09:32:59 UTC
    postgres_1      | 2019-05-19 09:32:59.601 UTC [40] LOG:  database system is ready to accept connections
    mailhog_1       | 2019/05/19 09:32:57 Using in-memory storage
    postgres_1      |  done
    postgres_1      | server started
    mailhog_1       | 2019/05/19 09:32:57 [SMTP] Binding to address: 0.0.0.0:1025
    mailhog_1       | [HTTP] Binding to address: 0.0.0.0:8025
    mailhog_1       | 2019/05/19 09:32:57 Serving under http://0.0.0.0:8025/
    postgres_1      | CREATE DATABASE
    mailhog_1       | Creating API v1 with WebPath:
    postgres_1      |
    mailhog_1       | Creating API v2 with WebPath:
    postgres_1      |
    postgres_1      | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
    postgres_1      |
    postgres_1      | 2019-05-19 09:33:00.080 UTC [40] LOG:  received fast shutdown request
    postgres_1      | waiting for server to shut down....2019-05-19 09:33:00.087 UTC [40] LOG:  aborting any active transactions
    postgres_1      | 2019-05-19 09:33:00.090 UTC [40] LOG:  worker process: logical replication launcher (PID 47) exited with exit code 1
    postgres_1      | 2019-05-19 09:33:00.090 UTC [42] LOG:  shutting down
    postgres_1      | 2019-05-19 09:33:00.110 UTC [40] LOG:  database system is shut down
    postgres_1      |  done
    postgres_1      | server stopped
    postgres_1      |
    postgres_1      | PostgreSQL init process complete; ready for start up.
    postgres_1      |
    postgres_1      | 2019-05-19 09:33:00.191 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
    redis_1         | 1:C 19 May 09:32:57.284 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
    postgres_1      | 2019-05-19 09:33:00.191 UTC [1] LOG:  listening on IPv6 address "::", port 5432
    redis_1         |                 _._
    postgres_1      | 2019-05-19 09:33:00.197 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
    postgres_1      | 2019-05-19 09:33:00.212 UTC [58] LOG:  database system was shut down at 2019-05-19 09:33:00 UTC
    postgres_1      | 2019-05-19 09:33:00.217 UTC [1] LOG:  database system is ready to accept connections
    redis_1         |            _.-``__ ''-._
    redis_1         |       _.-``    `.  `_.  ''-._           Redis 3.2.12 (00000000/0) 64 bit
    redis_1         |   .-`` .-```.  ```\/    _.,_ ''-._
    redis_1         |  (    '      ,       .-`  | `,    )     Running in standalone mode
    redis_1         |  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
    redis_1         |  |    `-._   `._    /     _.-'    |     PID: 1
    redis_1         |   `-._    `-._  `-./  _.-'    _.-'
    redis_1         |  |`-._`-._    `-.__.-'    _.-'_.-'|
    redis_1         |  |    `-._`-._        _.-'_.-'    |           http://redis.io
    redis_1         |   `-._    `-._`-.__.-'_.-'    _.-'
    redis_1         |  |`-._`-._    `-.__.-'    _.-'_.-'|
    redis_1         |  |    `-._`-._        _.-'_.-'    |
    redis_1         |   `-._    `-._`-.__.-'_.-'    _.-'
    redis_1         |       `-._    `-.__.-'    _.-'
    redis_1         |           `-._        _.-'
    redis_1         |               `-.__.-'
    redis_1         |
    redis_1         | 1:M 19 May 09:32:57.288 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
    redis_1         | 1:M 19 May 09:32:57.288 # Server started, Redis version 3.2.12
    celerybeat_1    | Waiting for PostgreSQL to become available...
    celerybeat_1    | Waiting for PostgreSQL to become available...
    redis_1         | 1:M 19 May 09:32:57.288 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
    redis_1         | 1:M 19 May 09:32:57.288 * The server is now ready to accept connections on port 6379
    celerybeat_1    | PostgreSQL is available
    celerybeat_1    | Error:
    celerybeat_1    | Unable to load celery application.
    celerybeat_1    | The module config was not found.
    celerybeat_1    |
    flower_1        | Waiting for PostgreSQL to become available...
    flower_1        | Waiting for PostgreSQL to become available...
    flower_1        | PostgreSQL is available
    flower_1        | Error:
    flower_1        | Unable to load celery application.
    flower_1        | The module config was not found.
    flower_1        |
    
    docker bug windows 
    opened by philiphoyos 43
  • Update to Django 1.10

    Update to Django 1.10

    Checklist:

    • [x] Before update to Django 1.10, create a git tag to current version of cookiecuter-django
    • [ ] Check if all dependencies officialy work with Django 1.10( if not, wait)
    • [x] Check that the tests pass on Django 1.10
    • [ ] Check that the tests pass on Django 1.10 with zero deprecation warnings messages: https://docs.djangoproject.com/en/1.10/howto/upgrade-version/#resolving-deprecation-warnings
    • [ ] Update to Django 1.10 and update other dependencies and:
      • [x] Check if all possible generated project layout still works on deploy on Heroku.
      • [ ] Check if all possible generated project layout still works on deploy on Docker.
      • [ ] Check PyCharm 2016.2 compatibility, with and widout docker
      • [x] Update the README.rst
      • [x] Update version on setup.py
      • [x] Update changelog.
      • [x] after update, create a git tag

    related: https://github.com/pydanny/cookiecutter-django/pull/702

    opened by luzfcb 41
  • WIP: Pycharm Support (including debugging in Docker!)

    WIP: Pycharm Support (including debugging in Docker!)

    The goal of this PR is to introduce a "ready to go" configuration for PyCharm.

    Moreover, this PR introduce debuggable dockercontainer, which can be build by debug.yml using docker-compass. Take a look on description in file:{{cookiecutter.repo_name}}/docs/docker_remote_debugging.rst

    Please Read: docker_remote_debugging.rst

    For PyCharm users, this PR provides more than 20 Run/Debug Configurations, which can be very easily activated in two easy steps.

    Instructions for other IDEs are more than welcome!

    ~~This PR has still status "Work in progress", because few other things has to be done:~~

    ToDo

    • [x] - pycharm and docker are now optional
      • [x] - if user decide not to use pycharm or docker, proper files are removed in post_gen_project.py hook
    • [x] - posibility of login into docker container with compose/pycharm/.ssh_keys_to_docker/id_rsa
    • [x] - user can compile scss file inside a docker container. Compass doesn't have to be installed on host machine
    • [x] - cleaning in /compose/pycharm/ directory. Directory should be renamed to /compose/debug/, pycharm related stuff should be moved somewhere else.
    • [x] - ~~move node to separate container, and building assets process to entrypoint script~~
    • [x] - fix problem with Fatal error: Unable to find local grunt. inside docker
    • [x] - dev.yml and debug.yml should use this same user. Note: django user is renamed (only in debug container!) to docker_{{ cookiecutter.repo_name }}, to improve visibility during debugging multiple containers.
    • [x] - improve .gitignore
    • [x] - rebase
    • [x] - write documentation in section Configure Remote Python Interpreter based on deployment settings in docs/docker_remote_debugging.rst
      • [x] - Add screenshots
    • [x] - ~~some tests~~, PoC prepared: https://github.com/pydanny/cookiecutter-django/issues/309
    opened by noisy 39
  • Consider removing Webpack/React option

    Consider removing Webpack/React option

    We are getting a lot of support requests for our Webpack integration. Unfortunately, it doesn't work with all setups configurations all the time. None of the core devs of this project are that knowledgable of the toolchain, and have difficulty helping users. Community assistance with the issue has also been negligible, and we're not even sure who understands the toolchain.

    Please share your opinions.

    Paging @goldhand, @jayfk, @luzfcb, @audreyr, @theskumar

    opened by pydanny 37
  • Replace Caddy with Traefik

    Replace Caddy with Traefik

    Description

    Replace Caddy with Traefik

    Rationale

    There is some trouble with the Caddy license (https://github.com/pydanny/cookiecutter-django/pull/1282#issuecomment-329617536)

    @drdaeman suggested using Traefik (https://github.com/pydanny/cookiecutter-django/pull/1282#issuecomment-353655273) which supports ACME and also plays very nice with Docker.

    Use case(s) / visualization(s)

    Comments

    I am currently using the proposed setup on a live site and it working great so far. If this PR is of interest to the maintainers, then I could commit more changes and take care of the documentation. Of course, any suggestions by the more experienced people around here, are welcome!

    opened by demestav 33
  • Enable user app routes when DEBUG is True only

    Enable user app routes when DEBUG is True only

    Description

    The user app exposes all users' details to any registered user. This was of course intentional, since the purpose of the user app is to demonstrate the functionality and not to be deployed in production as-is. However, a developer who is not familiar with the cookiecutter-django's structure, may overlook this and expose user information.

    Therefore, the user app should only be enabled when DEBUG == True in the settings.

    Closes #1739, Closes #1752.

    Rationale

    Since DEBUG = False in production settings, even if the user app is left as-is, it will not be enabled and users' information will not be exposed.

    ready for review 
    opened by demestav 29
  • Can't access admin site after deploy production.

    Can't access admin site after deploy production.

    When i deploy project in dev mode i can access admin site(127.0.0.0:8000/admin), but when I deploy project in production mode I can't access admin site(docker-machine-ip/admin). Note: other function still work fine,.env setting: DJANGO_ADMIN_URL=admin Any idea to enable admin site on production mode.

    opened by cunhuvan 28
  • Adding fields to the User model

    Adding fields to the User model

    Please excuse me if the answer to my question is painfully obvious but I'm new to Django and I'm not very familiar with custom user models.

    If I wanted to add another field to the user model (for example, "department" - the users are employees), where would I add it?

    I figured I could add a department variable to models.py but it doesn't seem to work. When I login to the admin site, I don't see a "department" field when I add a user. Similarly, I don't see a "name" field in the admin site - I only see First Name, Last Name, and Email Address.

    # models.py
    # -*- coding: utf-8 -*-
    from __future__ import unicode_literals, absolute_import
    
    from django.contrib.auth.models import AbstractUser
    from django.core.urlresolvers import reverse
    from django.db import models
    from django.utils.encoding import python_2_unicode_compatible
    
    
    @python_2_unicode_compatible
    class User(AbstractUser):
    
        # First Name and Last Name do not cover name patterns
        # around the globe.
        name = models.CharField(blank=True, max_length=255)
        department = models.CharField(blank=True, max_length=5)
    
        def __str__(self):
            return self.username
    
        def get_absolute_url(self):
            return reverse('users:detail', kwargs={'username': self.username})
    
    duplicate docs 
    opened by benjaminsingleton 26
  • Migrate to Pipfile

    Migrate to Pipfile

    • **I'm submitting a ... **
      • [ ] bug report
      • [X] feature request
      • [ ] support request => Please do not submit support request here, see note at the top of this template.

    It might be good if the project migrated from requirements.txt to a Pipfile/pipenv, which is a better method of tracking requirements and is the official Python replacement for requirements.txt as well.

    opened by skorokithakis 25
  • No support for python3? I am getting: invalid syntax: raise ValueError,

    No support for python3? I am getting: invalid syntax: raise ValueError, "No frame marked with %s." % fname

    File "/home/user/hosting/cookiecutter/lib/python3.6/site-packages/environ.py", line 114 raise ValueError, "No frame marked with %s." % fname ^ SyntaxError: invalid syntax

    Edited by maintainer:

    A possible solution is: https://github.com/cookiecutter/cookiecutter-django/issues/2106#issuecomment-553089821

    opened by emanresu92 24
  • Update tox to 4.2.3

    Update tox to 4.2.3

    This PR updates tox from 4.2.2 to 4.2.3.

    The bot wasn't able to find a changelog for this release. Got an idea?

    Links
    • PyPI: https://pypi.org/project/tox
    • Changelog: https://pyup.io/changelogs/tox/
    update 
    opened by pyup-bot 0
  • Error with staticfiles collection and missing source map files

    Error with staticfiles collection and missing source map files

    What happened?

    When I ran collectstatic on my production server, I get this error:

    Traceback (most recent call last):
      File "/tmp/8daedd4f753e458/manage.py", line 31, in <module>
        execute_from_command_line(sys.argv)
      File "/tmp/8daedd4f753e458/antenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
        utility.execute()
      File "/tmp/8daedd4f753e458/antenv/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/tmp/8daedd4f753e458/antenv/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
        self.execute(*args, **cmd_options)
      File "/tmp/8daedd4f753e458/antenv/lib/python3.10/site-packages/django/core/management/base.py", line 460, in execute
        output = self.handle(*args, **options)
      File "/tmp/8daedd4f753e458/antenv/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 209, in handle
        collected = self.collect()
      File "/tmp/8daedd4f753e458/antenv/lib/python3.10/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 154, in collect
        raise processed
    whitenoise.storage.MissingFileError: The file 'js/popper.js.map' could not be found with <whitenoise.storage.CompressedManifestStaticFilesStorage object at 0x7851a54578b0>.
    
    The JS file 'js/vendors.js' references a file which could not be found:
    
      js/popper.js.map
    
    Please check the URL references in this JS file, particularly any
    relative paths which might be pointing to the wrong location.
    

    The error comes because popper.js has this comment:

    //# sourceMappingURL=popper.min.js.map
    

    But popper.min.js.map is not copied into the static files directory.

    This general issue is reported as an issue in Django 4.1: https://code.djangoproject.com/ticket/33353#comment:15 And there was a fix to django-rest-framework to add source map files: https://github.com/encode/django-rest-framework/pull/8591

    I am not sure why I am seeing this in Django 4.0.8, since it's supposedly a 4.1 issue, but perhaps 4.0.8 manifests an earlier version of the issue.

    Proposed fix

    This is the change I made to my repo: https://github.com/pamelafox/cookiecutter-django-output/commit/c5e8166e40fb8c87f1ce11849ef246f98a52b6f5

    I modified the gulpfile to copy over the *.map files for the vendor files, and add *.map to the gitignore file.

    I can submit that as a pull request to this repository if it seems like a helpful change.

    Additional details

    This is the repository I deployed: https://github.com/pamelafox/cookiecutter-django-output/tree/961a1ebfd226ec1aa0726760e4c2fd46b7bc0840

    I deployed using the 'azd up' command to Azure App Service (using infrastructure files I wrote myself), and I found the error in the deployment center logs.

    I do not seem to get the error when I run manage.py collectstatic locally.

    bug 
    opened by pamelafox 0
  • Fix link, add non-Docker commands

    Fix link, add non-Docker commands

    Description

    The current coverage link is a 404 so I updated it to point to latest, similar to the pytest link. I also put the non-Docker version of commands first, to mirror what's done earlier in the article.

    Checklist:

    • [X] I've made sure that tests are updated accordingly (especially if adding or updating a template option)
    • [X] I've updated the documentation or confirm that my change doesn't require any updates

    Rationale

    Main motivation is fixing the 404.

    opened by pamelafox 0
  • Update sphinx to 6.0.0

    Update sphinx to 6.0.0

    This PR updates sphinx from 5.3.0 to 6.0.0.

    Changelog

    6.0.0

    =====================================
    
    Dependencies
    ------------
    
    * 10468: Drop Python 3.6 support
    * 10470: Drop Python 3.7, Docutils 0.14, Docutils 0.15, Docutils 0.16, and
    Docutils 0.17 support. Patch by Adam Turner
    
    Incompatible changes
    --------------------
    
    * 7405: Removed the jQuery and underscore.js JavaScript frameworks.
    
    These frameworks are no longer be automatically injected into themes from
    Sphinx 6.0. If you develop a theme or extension that uses the
    ``jQuery``, ``$``, or ``$u`` global objects, you need to update your
    JavaScript to modern standards, or use the mitigation below.
    
    The first option is to use the sphinxcontrib.jquery_ extension, which has been
    developed by the Sphinx team and contributors. To use this, add
    ``sphinxcontrib.jquery`` to the ``extensions`` list in ``conf.py``, or call
    ``app.setup_extension(&quot;sphinxcontrib.jquery&quot;)`` if you develop a Sphinx theme
    or extension.
    
    The second option is to manually ensure that the frameworks are present.
    To re-add jQuery and underscore.js, you will need to copy ``jquery.js`` and
    ``underscore.js`` from `the Sphinx repository`_ to your ``static`` directory,
    and add the following to your ``layout.html``:
    
    .. code-block:: html+jinja
    
      {%- block scripts %}
          &lt;script src=&quot;{{ pathto(&#x27;_static/jquery.js&#x27;, resource=True) }}&quot;&gt;&lt;/script&gt;
          &lt;script src=&quot;{{ pathto(&#x27;_static/underscore.js&#x27;, resource=True) }}&quot;&gt;&lt;/script&gt;
          {{ super() }}
      {%- endblock %}
    
    .. _sphinxcontrib.jquery: https://github.com/sphinx-contrib/jquery/
    
    Patch by Adam Turner.
    * 10471, 10565: Removed deprecated APIs scheduled for removal in Sphinx 6.0. See
    :ref:`dev-deprecated-apis` for details. Patch by Adam Turner.
    * 10901: C Domain: Remove support for parsing pre-v3 style type directives and
    roles. Also remove associated configuration variables ``c_allow_pre_v3`` and
    ``c_warn_on_allowed_pre_v3``. Patch by Adam Turner.
    
    Features added
    --------------
    
    * 10924: LaTeX: adopt better looking defaults for tables and code-blocks.
    See :confval:`latex_table_style` and the ``pre_border-radius`` and
    ``pre_background-TeXcolor`` :ref:`additionalcss` for the former defaults
    and how to re-enact them if desired.
    
    Bugs fixed
    ----------
    
    * 10984: LaTeX: Document :confval:`latex_additional_files` behavior for files
    with ``.tex`` extension.
    
    Links
    • PyPI: https://pypi.org/project/sphinx
    • Changelog: https://pyup.io/changelogs/sphinx/
    update 
    opened by pyup-bot 0
  • Revisiting the project root vs project_slug folder for creating apps

    Revisiting the project root vs project_slug folder for creating apps

    Description

    This issue is in the vein of #1725 and #3803, and discussions elsewhere e.g. https://stackoverflow.com/questions/39838290/is-there-a-command-for-creating-an-app-using-cookiecutter-django

    The basic question is where is the canonical place to create an app?

    • The most natural thing to do, ./manage.py startapp <app_name>, creates it at the root level which looks yucky.
    • Moving it manually and tinkering with apps.py aesthetically looks nice (except the LOCAL_APPS in settings) but seems to not work in edge cases. e.g., I use a lot of Django's lazy loading of ForeignKey models (using strings) to avoid circular imports. In this situation I'm now forced to say project_slug.app_name.ModelName which is not an allowed thing to do.

    My proposal is that we consider (the inner, as in not project root) {{cookiecutter.project_slug}} folder the root folder you'd get if you did django-admin.py startproject project_slug, and possibly even call it src.

    Then you'd have something like:

    {{cookiecutter.project_slug}}
    ├── compose
    ├── docs
    ├── locale
    ├── requirements
    └── src
        ├── manage.py
        ├── app1
        ├── app2
        ├── {{cookiecutter.project_slug}}
        │   ├── config
        │   │   └── settings
        │   ├── contrib
        │   │   └── sites
        │   │       └── migrations
        │   ├── static
        │   │   ├── css
        │   │   ├── fonts
        │   │   ├── images
        │   │   │   └── favicons
        │   │   ├── js
        │   │   └── sass
        │   ├── templates
        │   │   ├── account
        │   │   ├── pages
        │   │   └── users
        │   └── utils
        └── users
            ├── api
            ├── migrations
            └── tests
    

    In the above, the users app is no longer special, and doesn't need to be imported as {{cookiecutter.project_slug}}.users in the settings file. The config folder is also moved, but is perhaps not even necessary as it might be more vanilla Django to simply have.

    └── src
        ├── manage.py
        ├── app1
        ├── app2
        ├── {{cookiecutter.project_slug}}
        │   ├── settings
    
    

    I am a fan of this project and I try to use it and get caught up on this specific aspect of where to create an app every time I try. I would be willing to implement these proposed changes as an experiment if others agree with the general thought process.

    enhancement 
    opened by hnarayanan 4
  • Upgrade to Django 4.1

    Upgrade to Django 4.1

    With the merge of https://github.com/django-extensions/django-extensions/pull/1775 we are close to upgrading to Django 4.1. The new release of django-extensions will resolve #3941.

    This pull request gets everything ready for upgrading tot Django 4.1 and can be merged after the release of django-extensions and will close issue #3826.

    opened by foarsitter 0
Releases(2023.01.04)
Owner
Daniel Roy Greenfeld
Husband of @audreyfeldroy 💘, father of Uma 🍼, President/COO of feldroy.com, Co-Author of Two Scoops of Django, formerly @nasa, currently at @octoenergy
Daniel Roy Greenfeld
Combine the power of FastAPI and Django to build a production-ready application capable of utilizing all of the best features of both worlds.

FastAPI and Django Combo This projects aims to combine FastAPI and Django to build a Production ready application capable of utilizing all of the feat

Nsikak Imoh 33 Dec 27, 2022
Generic python project template

generic-python-project-template generic-python-project-template STEPS - STEP 01- Create a repository by using template repository STEP 02- Clone the n

SUNNY BHAVEEN CHANDRA 3 Oct 03, 2022
Get a Django app up and running in dev, test, and production with best practices in 10 minutes

Django template for Docker + Heroku This is how I set up Django projects to get up and running as quick as possible. In includes a few neat things: De

Ben Firshman 30 Oct 13, 2022
A template repository implementing HTML5 Boilerplate 8.0 in Sanic using the Domonic framework.

sanic-domonic-h5bp A template repository implementing HTML5 Boilerplate 8.0 in Sanic using the Domonic framework. If you need frontend interactivity,

PyXY 3 Dec 12, 2022
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

Daniel Roy Greenfeld 10k Jan 01, 2023
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

18.7k Jan 08, 2023
A simple cookiecutter to create Python Telegram bots, wrapped with Django.

PTB Django cookiecutter A simple cookiecutter to create Python Telegram bots, wrapped with Django. Based on this cool projects python-telegram-bot (PT

Carlos Lugones 20 Nov 12, 2022
Django Boilerplate - Material Kit Design | AppSeed

Django Boilerplate - Material Kit Design | AppSeed

App Generator 45 Dec 23, 2022
Code Kata Python Template

Code Kata Python Template This is the code kata template for python created by Aula de Software Libre de la Universidad de Córdoba Step 1. Use this re

Sergio Gómez 2 Nov 30, 2021
Bleeding edge django template focused on code quality and security.

wemake-django-template Bleeding edge django2.2 template focused on code quality and security. Purpose This project is used to scaffold a django projec

wemake.services 1.6k Jan 04, 2023
A boilerplate Django project for quickly getting started.

The Definitive Django Learning Platform. Django Project Boilerplate This repository is a boilerplate Django project for quickly getting started. Getti

Le Huynh Long 1 Nov 01, 2021
Boilerplate for starting a python project

Python Project Boilerplate Simple boilerplate for starting a python proect. Using the repo Follow following steps to install client on server Create a

Prajwal Dahal 1 Nov 19, 2021
Template repository to build PyTorch projects from source on any version of PyTorch/CUDA/cuDNN.

Template repository to build PyTorch projects from source on any version of PyTorch/CUDA/cuDNN.

Joonhyung Lee/이준형 651 Dec 12, 2022
Cookiecutter to create a Google Function. Powered by Poetry, GitHub actions, and Google Cloud Platform

Cookiecutter Google Function Cookiecutter template for a Google Function. Powered by Poetry, and GitHub actions. Quickstart Install the latest Cookiec

Arthur 1 Jan 07, 2022
Mad-cookiecutter - Cookiecutter templates for MaD projects

MaD Cookiecutter Templates A set of templates that can be used to quickly get st

Machine Learning and Data Analytics Lab FAU 1 Jan 10, 2022
Basic Docker Compose template application with Flask, Celery, Redis, MySQL, SocketIO, Nginx and Gunicorn.

Nginx / Gunicorn / Flask 🐍 / Celery / SocketIO / MySQL / Redis / Docker 🐳 sample application Basic Docker Compose template application for orchestat

Alex Oarga 8 Aug 06, 2022
Generic template for python service

Cookie cutter template example Technology stack Flask Gevent UWSGI Poetry Docker Docker-compose Installation pip install cookiecutter cookiecutter git

Churkin Oleg 11 Oct 22, 2022
Python-boilerplate - Python Boilerplate Project Structure

python-boilerplate Python Boilerplate Project Structure Folder Structure .github

1 Jan 18, 2022
Brif is a boilerplate tool based on Docker and FastAPI, designed to streamline the development and deployment of IIIF compliant platforms.

brif A boilerplate tool based on Docker, designed to streamline the development and deployment of IIIF compliant platforms. Embedded with FastAPI, Cel

Pierre 8 Sep 17, 2022
This is a boilerplate for a basic backend app using Python, Django and SQLite, as developed after tutorials with Programming with Mosh

This is a boilerplate for a basic backend app using Python, Django and SQLite, as developed after tutorials with Programming with Mosh

Gustavo Catala Sverdrup 1 Jan 07, 2022