diff --git a/.djinit b/.djinit index f2ebfaa..b841008 100644 --- a/.djinit +++ b/.djinit @@ -1,9 +1,9 @@ { - "project_name": ".", + "project_name": "config", "structure": { - "standard": false, + "standard": true, "predefined": false, - "unified": true, + "unified": false, "single": false }, "apps": { diff --git a/.env.sample b/.env.sample index 9c46580..60a1bec 100644 --- a/.env.sample +++ b/.env.sample @@ -1,10 +1,10 @@ # Django settings -DJANGO_SETTINGS_MODULE=core.settings.development +DJANGO_SETTINGS_MODULE=config.settings.development SECRET_KEY=your-secret-key ALLOWED_HOSTS=api.your-domain.com,www.your-domain.com # Database URL (recommended for production) -DATABASE_URL=postgres://user:password@localhost:5432/core +DATABASE_URL=postgres://user:password@localhost:5432/config # Frontend URL FRONTEND_URL=https://frontend.your-domain.com,www.frontend.your-domain.com diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 79c1c55..0000000 --- a/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2026, Sankalp Tharu - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Procfile b/Procfile index db5007c..a36a146 100644 --- a/Procfile +++ b/Procfile @@ -1,20 +1,20 @@ -# Procfile for . +# Procfile for config # Used for deploying to PaaS platforms like Heroku, Railway, Render, etc. # Web server process (using Gunicorn) # Adjust workers based on your needs: (2 x CPU cores) + 1 -web: gunicorn core.wsgi:application --bind 0.0.0.0:$PORT --workers 2 --timeout 120 --access-logfile - --error-logfile - --log-level info +web: gunicorn config.wsgi:application --bind 0.0.0.0:$PORT --workers 2 --timeout 120 --access-logfile - --error-logfile - --log-level info # Alternative web server configurations (uncomment to use): -# web: gunicorn core.wsgi:application --bind 0.0.0.0:$PORT --workers 4 --threads 2 --timeout 120 -# web: gunicorn core.wsgi:application --bind 0.0.0.0:$PORT --workers 2 --worker-class gevent --worker-connections 1000 --timeout 120 +# web: gunicorn config.wsgi:application --bind 0.0.0.0:$PORT --workers 4 --threads 2 --timeout 120 +# web: gunicorn config.wsgi:application --bind 0.0.0.0:$PORT --workers 2 --worker-class gevent --worker-connections 1000 --timeout 120 # Release task (runs migrations before deployment) release: python manage.py migrate --noinput && python manage.py collectstatic --noinput # Uncomment below to run scheduled tasks (if using Celery) -# worker: celery -A core worker --loglevel=info -# beat: celery -A core beat --loglevel=info +# worker: celery -A config worker --loglevel=info +# beat: celery -A config beat --loglevel=info # Development server (for local testing with Foreman/Overmind) # web: python manage.py runserver 0.0.0.0:$PORT \ No newline at end of file diff --git a/README.md b/README.md index e367400..002b126 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# . +# config A Django project folder structure is generated with [djinitx/djinit/dj](https://github.com/S4NKALP/djinit). @@ -71,45 +71,38 @@ Run `just` to see all available commands, including: ## Project Structure ``` -./ -├── apps/ -│ ├── admin/ -│ │ └── __init__.py -│ ├── api/ -│ │ ├── __init__.py -│ │ ├── urls.py -│ │ └── v1/ -│ │ ├── __init__.py -│ │ └── urls.py -│ ├── models/ -│ │ └── __init__.py -│ ├── serializers/ -│ │ └── __init__.py -│ ├── tests/ -│ │ └── __init__.py -│ ├── urls/ -│ │ └── __init__.py -│ └── views/ -│ └── __init__.py -├── core/ -│ ├── asgi.py -│ ├── __init__.py +config/ +├── config/ │ ├── settings/ │ │ ├── base.py │ │ ├── development.py -│ │ ├── __init__.py │ │ └── production.py +│ ├── admin/ +│ ├── api/ # API endpoints organized by model +│ │ ├── user/ # Example: if you have a User model +│ │ │ ├── views.py +│ │ │ ├── serializers.py +│ │ │ └── urls.py +│ │ └── urls.py +│ ├── models/ # Django models +│ ├── tests/ │ ├── urls.py -│ └── wsgi.py +│ ├── wsgi.py +│ └── asgi.py ├── manage.py ├── requirements.txt ├── pyproject.toml ├── uv.lock ├── .env.sample -├── justfile -├── Procfile -├── runtime.txt └── README.md + +**Note:** For the single folder layout, organize your API endpoints by model name under the `api/` directory. +For example, if you have a `User` model in `models/user.py`, create: +- `api/user/views.py` - API views for User +- `api/user/serializers.py` - Serializers for User +- `api/user/urls.py` - URL patterns for User endpoints + +See the README files in `api/` and `models/` directories for more details. ``` ## API Documentation diff --git a/justfile b/justfile index e885bc5..ab66d62 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,4 @@ -# Justfile for . +# Justfile for config # Task runner for Django development # Install just: https://github.com/casey/just @@ -118,15 +118,15 @@ dbshell: # Start production server with gunicorn server: - uv run gunicorn core.wsgi:application --bind 0.0.0.0:8000 + uv run gunicorn config.wsgi:application --bind 0.0.0.0:8000 # Start production server with gunicorn workers server-prod WORKERS="4": - uv run gunicorn core.wsgi:application --bind 0.0.0.0:8000 --workers {{ WORKERS }} + uv run gunicorn config.wsgi:application --bind 0.0.0.0:8000 --workers {{ WORKERS }} # Start production server with gunicorn and reload on file changes server-watch: - uv run gunicorn core.wsgi:application --bind 0.0.0.0:8000 --reload + uv run gunicorn config.wsgi:application --bind 0.0.0.0:8000 --reload # Clean Python cache files clean: diff --git a/manage.py b/manage.py index d446962..acda5d2 100755 --- a/manage.py +++ b/manage.py @@ -11,7 +11,7 @@ import environ def main(): """Run administrative tasks.""" - os.environ.setdefault("DJANGO_SETTINGS_MODULE", os.getenv("DJANGO_SETTINGS_MODULE", "core.settings.production")) + os.environ.setdefault("DJANGO_SETTINGS_MODULE", os.getenv("DJANGO_SETTINGS_MODULE", "config.settings.production")) try: from django.core.management import execute_from_command_line diff --git a/pyproject.toml b/pyproject.toml index 537cddb..0cbe350 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,4 +41,4 @@ ignore = [ ] [tool.ruff.lint.isort] -known-first-party = ["core"] +known-first-party = ["config"]