# django-startsubapp
A Django management command that creates Django apps inside a dedicated `apps/` folder to keep your project structure clean and organized.
## Features
- 🚀 Create Django apps directly inside the `apps/` folder
- 📦 Automatically handles app structure and configuration
- 🔧 Simple command: `python manage.py startsubapp [app_name]`
- 🛡️ Input validation to prevent errors
- ✨ Enhanced user feedback with status messages
## Installation
### Via PyPI
```bash
pip install django-startsubapp
```
### Development Installation
```bash
git clone https://github.com/Saman-naruee/django-startsubapp.git
cd django-startsubapp
pip install -e .
```
## Quick Start
### 1. Add to Django Project
Add `startsubapp` to your Django project's `INSTALLED_APPS` in `settings.py`:
```python
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
# ... other apps
'startsubapp',
]
```
### 2. Create a New Sub-App
Run the management command:
```bash
python manage.py startsubapp myapp
```
This will create:
```
myproject/
├── apps/
│ └── myapp/
│ ├── migrations/
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── models.py
│ ├── tests.py
│ ├── views.py
│ └── ...
├── manage.py
└── ...
```
### 3. Update Your Settings
Add the new app to `INSTALLED_APPS`:
```python
INSTALLED_APPS = [
# ... other apps
'apps.myapp', # Note: apps.myapp format
]
```
## Usage
### Command Syntax
```bash
python manage.py startsubapp [app_name]
```
### Example
Create an accounts app:
```bash
python manage.py startsubapp accounts
```
This creates `apps/accounts/` with all necessary Django app files.
## How It Works
1. Creates the `apps/` folder if it doesn't exist
2. Uses Django's built-in `startapp` command to create the app structure
3. Moves the app from the project root into the `apps/` folder
4. Ensures proper `__init__.py` exists in the app directory
5. Automatically configures the app's `apps.py` with the correct path
## Error Handling
The command includes validation for:
- **Invalid app names**: Prevents dots (`.`) in app names
- **Existing apps**: Checks for conflicts before creation
- **File system errors**: Handles file operations safely
Example error message:
```bash
$ python manage.py startsubapp my.app
Error: Dots not allowed in app_name. Use simple name like 'accounts'
```
## Project Structure
The package follows modern Python packaging standards:
```
django-startsubapp/
├── src/
│ └── startsubapp/
│ ├── __init__.py
│ ├── apps.py
│ └── management/
│ └── commands/
│ └── startsubapp.py
├── tests/
│ └── test_basic.py
├── pyproject.toml
├── setup.cfg
├── README.md
├── LICENSE
└── .gitignore
```
## Requirements
- Python 3.8+
- Django 3.0+
## Testing
Run tests with:
```bash
python -m pytest tests/
```
## Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Author
**Saman Naruee**
- Email: samannaruee@gmail.com
- GitHub: [@Saman-naruee](https://github.com/Saman-naruee)
## Support
If you encounter any issues, please open an issue on [GitHub](https://github.com/Saman-naruee/django-startsubapp/issues).
## Changelog
### v1.0.0 (Initial Release)
- Initial release of django-startsubapp
- Basic functionality for creating sub-apps in `apps/` folder
- Full validation and error handling
- PyPI publication
Raw data
{
"_id": null,
"home_page": "https://github.com/Saman-naruee/django-startsubapp",
"name": "django-startsubapp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "django, management-command, app-structure, django-apps",
"author": "Saman Naruee",
"author_email": "Saman Naruee <samannaruee@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/c8/26/20c98abbb8e8e2924b794865b7f4530ef6aef6f698ab34ccfd12473adcde/django_startsubapp-1.0.0.tar.gz",
"platform": null,
"description": "# django-startsubapp\r\n\r\nA Django management command that creates Django apps inside a dedicated `apps/` folder to keep your project structure clean and organized.\r\n\r\n## Features\r\n\r\n- \ud83d\ude80 Create Django apps directly inside the `apps/` folder\r\n- \ud83d\udce6 Automatically handles app structure and configuration\r\n- \ud83d\udd27 Simple command: `python manage.py startsubapp [app_name]`\r\n- \ud83d\udee1\ufe0f Input validation to prevent errors\r\n- \u2728 Enhanced user feedback with status messages\r\n\r\n## Installation\r\n\r\n### Via PyPI\r\n\r\n```bash\r\npip install django-startsubapp\r\n```\r\n\r\n### Development Installation\r\n\r\n```bash\r\ngit clone https://github.com/Saman-naruee/django-startsubapp.git\r\ncd django-startsubapp\r\npip install -e .\r\n```\r\n\r\n## Quick Start\r\n\r\n### 1. Add to Django Project\r\n\r\nAdd `startsubapp` to your Django project's `INSTALLED_APPS` in `settings.py`:\r\n\r\n```python\r\nINSTALLED_APPS = [\r\n 'django.contrib.admin',\r\n 'django.contrib.auth',\r\n # ... other apps\r\n 'startsubapp',\r\n]\r\n```\r\n\r\n### 2. Create a New Sub-App\r\n\r\nRun the management command:\r\n\r\n```bash\r\npython manage.py startsubapp myapp\r\n```\r\n\r\nThis will create:\r\n```\r\nmyproject/\r\n\u251c\u2500\u2500 apps/\r\n\u2502 \u2514\u2500\u2500 myapp/\r\n\u2502 \u251c\u2500\u2500 migrations/\r\n\u2502 \u251c\u2500\u2500 __init__.py\r\n\u2502 \u251c\u2500\u2500 admin.py\r\n\u2502 \u251c\u2500\u2500 apps.py\r\n\u2502 \u251c\u2500\u2500 models.py\r\n\u2502 \u251c\u2500\u2500 tests.py\r\n\u2502 \u251c\u2500\u2500 views.py\r\n\u2502 \u2514\u2500\u2500 ...\r\n\u251c\u2500\u2500 manage.py\r\n\u2514\u2500\u2500 ...\r\n```\r\n\r\n### 3. Update Your Settings\r\n\r\nAdd the new app to `INSTALLED_APPS`:\r\n\r\n```python\r\nINSTALLED_APPS = [\r\n # ... other apps\r\n 'apps.myapp', # Note: apps.myapp format\r\n]\r\n```\r\n\r\n## Usage\r\n\r\n### Command Syntax\r\n\r\n```bash\r\npython manage.py startsubapp [app_name]\r\n```\r\n\r\n### Example\r\n\r\nCreate an accounts app:\r\n\r\n```bash\r\npython manage.py startsubapp accounts\r\n```\r\n\r\nThis creates `apps/accounts/` with all necessary Django app files.\r\n\r\n## How It Works\r\n\r\n1. Creates the `apps/` folder if it doesn't exist\r\n2. Uses Django's built-in `startapp` command to create the app structure\r\n3. Moves the app from the project root into the `apps/` folder\r\n4. Ensures proper `__init__.py` exists in the app directory\r\n5. Automatically configures the app's `apps.py` with the correct path\r\n\r\n## Error Handling\r\n\r\nThe command includes validation for:\r\n\r\n- **Invalid app names**: Prevents dots (`.`) in app names\r\n- **Existing apps**: Checks for conflicts before creation\r\n- **File system errors**: Handles file operations safely\r\n\r\nExample error message:\r\n\r\n```bash\r\n$ python manage.py startsubapp my.app\r\nError: Dots not allowed in app_name. Use simple name like 'accounts'\r\n```\r\n\r\n## Project Structure\r\n\r\nThe package follows modern Python packaging standards:\r\n\r\n```\r\ndjango-startsubapp/\r\n\u251c\u2500\u2500 src/\r\n\u2502 \u2514\u2500\u2500 startsubapp/\r\n\u2502 \u251c\u2500\u2500 __init__.py\r\n\u2502 \u251c\u2500\u2500 apps.py\r\n\u2502 \u2514\u2500\u2500 management/\r\n\u2502 \u2514\u2500\u2500 commands/\r\n\u2502 \u2514\u2500\u2500 startsubapp.py\r\n\u251c\u2500\u2500 tests/\r\n\u2502 \u2514\u2500\u2500 test_basic.py\r\n\u251c\u2500\u2500 pyproject.toml\r\n\u251c\u2500\u2500 setup.cfg\r\n\u251c\u2500\u2500 README.md\r\n\u251c\u2500\u2500 LICENSE\r\n\u2514\u2500\u2500 .gitignore\r\n```\r\n\r\n## Requirements\r\n\r\n- Python 3.8+\r\n- Django 3.0+\r\n\r\n## Testing\r\n\r\nRun tests with:\r\n\r\n```bash\r\npython -m pytest tests/\r\n```\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please feel free to submit issues or pull requests.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Author\r\n\r\n**Saman Naruee**\r\n- Email: samannaruee@gmail.com\r\n- GitHub: [@Saman-naruee](https://github.com/Saman-naruee)\r\n\r\n## Support\r\n\r\nIf you encounter any issues, please open an issue on [GitHub](https://github.com/Saman-naruee/django-startsubapp/issues).\r\n\r\n## Changelog\r\n\r\n### v1.0.0 (Initial Release)\r\n- Initial release of django-startsubapp\r\n- Basic functionality for creating sub-apps in `apps/` folder\r\n- Full validation and error handling\r\n- PyPI publication\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Django management command to create apps in a subdirectory (e.g., apps/) for better project organization",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://github.com/Saman-naruee/django-startsubapp#readme",
"Homepage": "https://github.com/Saman-naruee/django-startsubapp",
"Issues": "https://github.com/Saman-naruee/django-startsubapp/issues",
"Repository": "https://github.com/Saman-naruee/django-startsubapp.git"
},
"split_keywords": [
"django",
" management-command",
" app-structure",
" django-apps"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "63a6e545466bb4e6c81cd09c66e35c35300768dd361929b21505a5d1303b1624",
"md5": "8e510e1dcee94eba66110c427f12ce4f",
"sha256": "a422637965db93cc27e98c5ec8605fa0f8e1e2cb598595eb915a60031c4d374f"
},
"downloads": -1,
"filename": "django_startsubapp-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e510e1dcee94eba66110c427f12ce4f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 6168,
"upload_time": "2025-10-19T00:10:07",
"upload_time_iso_8601": "2025-10-19T00:10:07.788127Z",
"url": "https://files.pythonhosted.org/packages/63/a6/e545466bb4e6c81cd09c66e35c35300768dd361929b21505a5d1303b1624/django_startsubapp-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c82620c98abbb8e8e2924b794865b7f4530ef6aef6f698ab34ccfd12473adcde",
"md5": "1b9d2db18321a653479339830322813b",
"sha256": "a5cfd1a903ce900cee66bd9b7346b68da100d4e0c8ec6a411b25d54054877cd3"
},
"downloads": -1,
"filename": "django_startsubapp-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "1b9d2db18321a653479339830322813b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 6517,
"upload_time": "2025-10-19T00:10:09",
"upload_time_iso_8601": "2025-10-19T00:10:09.397644Z",
"url": "https://files.pythonhosted.org/packages/c8/26/20c98abbb8e8e2924b794865b7f4530ef6aef6f698ab34ccfd12473adcde/django_startsubapp-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-19 00:10:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Saman-naruee",
"github_project": "django-startsubapp",
"github_not_found": true,
"lcname": "django-startsubapp"
}