{"id":20731911,"url":"https://github.com/thorgate/django-project-template","last_synced_at":"2025-04-05T20:08:41.028Z","repository":{"id":9519252,"uuid":"54900918","full_name":"thorgate/django-project-template","owner":"thorgate","description":"Thorgate's Django project template - Django, React, Sass, optional Docker and more","archived":false,"fork":false,"pushed_at":"2024-10-18T11:09:23.000Z","size":2834,"stargazers_count":124,"open_issues_count":12,"forks_count":16,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-29T19:07:33.208Z","etag":null,"topics":["cookiecutter","django","docker","docker-compose","javascript","react","template","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thorgate.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-28T15:10:57.000Z","updated_at":"2025-01-01T01:32:06.000Z","dependencies_parsed_at":"2024-05-16T11:33:26.184Z","dependency_job_id":"97d8ff39-8d9a-4f17-a9fa-0a0ee5f91ffe","html_url":"https://github.com/thorgate/django-project-template","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thorgate%2Fdjango-project-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thorgate%2Fdjango-project-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thorgate%2Fdjango-project-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thorgate%2Fdjango-project-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thorgate","download_url":"https://codeload.github.com/thorgate/django-project-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393570,"owners_count":20931813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cookiecutter","django","docker","docker-compose","javascript","react","template","webpack"],"created_at":"2024-11-17T05:16:55.314Z","updated_at":"2025-04-05T20:08:41.005Z","avatar_url":"https://github.com/thorgate.png","language":"JavaScript","funding_links":[],"categories":["Django"],"sub_categories":["Phaser"],"readme":"# Thorgate's Django template\n\n[![Build status](https://gitlab.com/thorgate-public/django-project-template/badges/master/pipeline.svg)](https://gitlab.com/thorgate-public/django-project-template/commits/master)\n\n[Django](https://www.djangoproject.com/) project template that we use at [Thorgate](https://thorgate.eu).\n\nBest suited for medium-sized and bigger apps that use JavaScript and React for frontend or single page web applications.\n\n_(note that the primary repo is in [Gitlab](https://gitlab.com/thorgate-public/django-project-template), with mirror in [Github](https://github.com/thorgate/django-project-template))_\n\n\n## Features\n\n- Django-based backend\n\n    - [Django](https://www.djangoproject.com/)\n    - Separate settings for different environments (local/staging/production)\n    - Python 3.6 or later\n    - [SPA] Accessible from port `3000` for local development\n\n- Frontend app with JavaScript (ES2015), React and Sass\n\n    - Latest JavaScript features from [ES2015](https://babeljs.io/docs/learn-es2015/) and beyond, transpiled with\n      [Babel](https://babeljs.io/)\n    - [React](https://facebook.github.io/react/) for fast modular user interfaces\n    - [Sass](http://sass-lang.com/), [PostCSS](http://postcss.org/) and\n      [Autoprefixer](https://github.com/postcss/autoprefixer) for more convenient styling\n    - [Webpack](https://webpack.github.io/) is used to bundle and minify JavaScript and styles\n    - [SPA] [Razzle](https://razzlejs.org/) for preconfigured isomorphic application\n    - [SPA] Accessible from port `8000` for local development\n\n- Batteries\n\n    - Docker / Docker Compose integration\n    - Linting of Python, JavaScript and Sass code with [Prospector](http://prospector.landscape.io/),\n      [ESLint](http://eslint.org/) and [stylelint](https://stylelint.io/)\n    - Automated code-formatting using [black](https://black.readthedocs.io) and [prettier](https://prettier.io)\n    - [py.test](http://pytest.org/) and [coverage](https://coverage.readthedocs.io/) integration\n    - Deploy helpers, using [Ansible](https://www.ansible.com/)\n    - Media files are stored in a CDN like S3 or Google Cloud Storage\n    - Out-of-the-box configuration for nginx, gunicorn and logrotate\n    - Includes [PyCharm](https://www.jetbrains.com/pycharm/) project config\n\n\n## Usage\n\nTo use this template, first ensure that you have\n[Poetry](https://python-poetry.org/docs/) available.\n\nAfter that, you should:\n\n1. Install the requirements of the project template by running\n    ```\n    poetry install\n    ```\n2. Activate the virtualenv created by _poetry_:\n    ```\n    poetry shell\n    ```\n3. Navigate to the directory where you'd like to create your project:\n    ```\n    cd /home/my-awesome-projects/\n    ```\n\n4. Create a new project by executing:\n    ```\n    cookiecutter dir/to/django-project-template/\n    ```\n\n\nIt will ask you a few questions, e.g. project's name, python version and so on. **For a reference of all the configuration options** see [CookiecutterVariables.md](./CookiecutterVariables.md) file.\n\n\n\nTo create isomorphic single-page application set `frontend_style == spa`. Then separate node application will be created supported by [Razzle](https://razzlejs.org/)\n\nAfter generation completes, **you should deactivate virtual environment for cookiecutter**,\nsearch for any TODOs in the code and make appropriate changes where needed.\n\nSee README.md in the generated project for instructions on how to set up your development environment.\n\n\n## Different frontend styles\n\n### SPA\n\nIsomorphic Javascript single-page application rendered with node and backed by Django Rest Framework. Enabled with `frontend_style == spa`.\nDuring development and production separate node container is used to run and serve assets if needed.\nTranslations are done with [i18next](https://www.i18next.com/) and its companion library for React.\n\n### Webapp\n\nReact powered application rendered with Django templates. This is the default option. Enabled with `frontend_style == webapp`.\nDuring development separate container is used to build assets. In production, node built with multi-stage image.\nTranslations are done with Django JavaScriptCatalog.\n\n\n## Upgrading project template\n\nFirst ensure you have a python3 interpreter with `cookiecutter` installed.\n\nTo upgrade an existing project, change the current working directory to the root of the project you want to upgrade. i.e. `cd project-to-upgrade`. Ensure your have not checked out the `template` branch.\n\nThen run `python ~/path/to/django-project-template/upgrade-template.py`\n\nThis will make a commit to the branch `template` in your project with the updates to the project template. Then merge the `template` branch.\n\n## Applying codemods\n\nFirst activate Python 3 interpreter with required dependencies and ensure `docker` is installed and working.\n\nChange the current working directory to the root of the project you want to apply codemods for. i.e. `cd project-to-upgrade`.\n\nThen run `python ~/path/to/django-project-template/upgrade-template.py --apply-frontend-codemods`\n\nThis will build custom docker image to update old frontend versions.\n\n## Docker images\n\nThe template uses our own images for CI runs. One for the template itself and a second one\nfor generated projects. Both images are alpine based and contain python3, pip and some support\npackages. The images are published to [repository container registry](https://gitlab.com/thorgate-public/django-project-template/container_registry) and also to [docker hub](https://hub.docker.com/u/thorgate).\n\nThe images are built in CI (from default branches only) and also updated every day via schedules.\n\n**Project CI Image**\n\n- [Dockerfile-ci](./utils/Dockerfile-ci)\n- Image in repository registry: `registry.gitlab.com/thorgate-public/django-project-template/ci`\n- Image in docker hub: `thorgate/django-template-ci`\n  - [see online](https://hub.docker.com/r/thorgate/django-template-ci)\n\n**Template CI Image:**\n\n- [Dockerfile-base-ci](./utils/Dockerfile-base-ci)\n- Image in repository registry: `registry.gitlab.com/thorgate-public/django-project-template/base-ci`\n- Image in docker hub: `thorgate/django-template-base-ci`\n  - [see online](https://hub.docker.com/r/thorgate/django-template-base-ci)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorgate%2Fdjango-project-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthorgate%2Fdjango-project-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthorgate%2Fdjango-project-template/lists"}