This is the Django-based server for my photo management system. See Photo-Manager-Client for more information about the project, as well as the client-side code.
- Install Python and CMake.
- Clone this repository (
git clone https://github.com/zsmith3/Photo-Manager-Server/
) and enter it (cd Photo-Manager-Server
) - Install dependencies and collect static files:
pip install -r requirements.txt
python manage.py collectstatic
- This will have auto-generated a user-specific settings file at ./photo_manager/settings/user.py, with a random
SECRET_KEY
. You should add any custom settings you want to this file. For example, I use PostgreSQL:When a user downloads a file, a .zip file is created inDATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", "HOST": "localhost", "PORT": "5432", "NAME": "postgres", "USER": "postgres", "PASSWORD": "password" } }
DOWNLOADS_DIR
, which should then be hosted by a web server atDOWNLOADS_URL
- both of these settings must be specified for downloads to work. - Now perform database migrations:
python manage.py makemigrations
python manage.py makemigrations fileserver
python manage.py migrate
python manage.py createsuperuser
(optional)
- For production use (NOTE this is not production-ready yet), use any WSGI-supporting web server. I use Apache, and recommend using and forcing HTTPS. See here for instructions on hosting Django through Apache.
- Having followed the installation steps above, you should now be able to run the server with
python manage.py runserver
- (Currently) add a new RootFolder using the admin page (/admin). Select a created RootFolder and use the options menu to scan the filesystem and update the database.
This codebase uses YAPF for formatting - use the following command to auto-format all files:
yapf --in-place --recursive --style='{column_limit: 180}' --exclude='**/migrations/**' .
Any contribution would be welcomed and greatly appreciated, even if just in the form of suggestions/bug reports.