Pinax Project Structure
Typical Django Project and App Structure
Typically, when a Django project is created, the default Django project and app code will be installed in one directory.
directory_name/
|-- project_name/
| |-- app_name/ <-- Django app
| | |-- __init__.py
| | |-- admin.py
| | |-- apps.py
| | |-- migrations/
| | | |-- __init__.py
| | |-- models.py
| | |-- tests.py
| | |-- views.py
| |-- project_name/ <-- Django project
| | |-- __init__.py
| | |-- settings.py
| | |-- urls.py
| | |-- wsgi.py
| |-- manage.py
|-- venv/ (if used)
Pinax Starter Project and Packages Directory Structure
Lke any other Django project, a Pinax starter project is installed in the directory of your choice on your computer.
However, the Pinax apps you install in your project are not located in the project directory like regular Django apps. Because Pinax apps are packages, they will be found in the project's packages directory, along with the other project packages.
Because Pinax apps provide the website functionality, you might not need to install a Django app.
Below is an example computer home directory layout where your Pinax starter project directory and your .local directory (containing your project's packages directory) might co-exist.
.local/
|-- bin/
|-- lib/
|-- share/
| |-- virtualenvs/
| | |-- pinax-project/
| | |-- bin/
| | |-- include/
| | |-- lib/
| | | |-- python3.6/
| | | | |-- site-packages/
| | | | | |-- pinax/
| | | | | | |-- app-name/ <-- Pinax app
| | | | | | | |-- __init__.py
| | | | | | | |-- admin.py
| | | | | | | |-- apps.py
| | | | | | | |-- migrations/
| | | | | | | | |-- __init__.py
| | | | | | | |-- models.py
| | | | | | | |-- tests.py
| | | | | | | |-- views.py
directory_name/
|-- project_name/
| |-- project_name/ <-- Pinax project
| | |-- __init__.py
| | |-- settings.py
| | |-- urls.py
| | |-- wsgi.py
| |-- manage.py
|-- venv/ (if used)
sys Module
Based on the app names in INSTALLED_APPS
, Python will use sys.path in the sys module to locate the packages in the packages directory and will use them as if they are apps installed directly in the project.
How to Locate Your Packages
Locating and looking through your project packages installed on your computer can help you to better understand how your project, and Python in general, work. You can also make changes within your package locally to test or customize your project.
Hidden Files
Packages are stored in a hidden directory that you need to unhide in order to find the packages. Hidden folders and files start with a dot and are called dot folders and files.
On a Mac, one easy way to unhide and hide hidden folders and files is to toggle back and forth using the key combination command + shift + .
.