-
Notifications
You must be signed in to change notification settings - Fork 8
Server
#Getting Started
##Depenceies
##Installation
###Web Server For help setting up a web server Web Server
###New Installation
- Install Django
- cd into the dir where you want to project to reside
- type in
python django-admin.py startproject [projectname] - Call it whatever you like
- cd into this new project dir
- Follow the instructions for an existing project below
###Migrations Since Frog is updated through pip, it will be deleted and reinstalled each time. This will remove any previous schema migrations performed. So we'll need to store these migrations in the project dir.
- Under the project root, create a folder called
migrations - Create an empty file in
migrationscalled__init__.pyto make it a package that can be imported
###Settings Edit your project settings.py and add the following
SITE_URL = 'http://servername'
DOMAIN = 'yourdomain.com'
## -- Video settings
FFMPEG = 'path/to/ffmpeg'
FFMPEG_ARGS = '-vcodec libx264 -b:v 2500k -acodec libvo_aacenc -b:a 56k -ac 2 -y'
SCRUB_FFMPEG_ARGS = '-vcodec libx264 -b:v 2500k -x264opts keyint=1:min-keyint=8 -acodec libvo_aacenc -b:a 56k -ac 2 -y'
SCRUB_DURATION = 60
## -- Image settings
IMAGE_SIZE_CAP = 5120
IMAGE_SMALL_SIZE = 600
THUMB_SIZE = 256
SOUTH_MIGRATION_MODULES = {
'frog': 'migrations',
}
The SOUTH_MIGRATION_MODULES is very important as the migrations need to be stored somewhere other than the app folder because each time you use pip to update frog it removes anything in the folder. Specify your project as the place to store migrations for frog will keep them in a safe place. Just replace dev with your project name.
###Existing Django project
- At a command line type in
pip install django-frog
- Once frog has been installed, you'll need to make some symlinks to the static files
- Make a symlink (windows use mklink) to your static dir folder root to point to frog/static so urls like /static/frog/.../frog.js can be resolved
- For example if your static root is at
/www/staticand frog is located at/usr/local/lib/python27/site-packages/frog - Linux:
ln -s /usr/local/lib/python27/site-packages/frog/static /www/static/frog - Windows:
mklink /D C:\Python27\Lib\site-packages\frog\static C:\www\static - Edit your project settings.py
- Add
'frog'to theINSTALLED_APPSlist - Add
'frog.context_processors.media'to yourTEMPLATE_CONTEXT_PROCESSORSlist - Run
python manage.py schemamigration frog --initial
At this point you should be all set for deployment. The app does rely on the following middlewares to be enabled:
django.contrib.sessions.middleware.SessionMiddlewaredjango.middleware.csrf.CsrfViewMiddlewaredjango.contrib.auth.middleware.AuthenticationMiddlewaredjango.contrib.messages.middleware.MessageMiddleware
#REST API The following API requests will return a Response object unless it is an HTML rendered request. ##Response { "isSuccess": true, // Did the request succeed "isError": false, // Did the request fail "message": "", // A string relevent to the request result "values": [], // A list of objects. This will always contain the object in "value" "value": {} // An object. If the request was for a list, this will be the first member of the list } This format standardizes what information you get back from each response. ##Gallery GET / List of all galleries POST / name=&private= Create new gallery GET /ID Html rendered page of gallery GET /ID/filter filters=&rng&more&models Filtered list of objects DELETE /ID guids= Removes objects PUT /ID guids= Adds objects
##Image/Video GET /ID json= Page that opens viewer with object DELETE /ID Deletes object POST /ID tags= Adds tags to object
##Tag GET / json=&tree= Page with tree of tags GET /ID json=&types= List of objects with type POST / tags=&guids= Adds tags to objects DELETE / tags=&guids= Removes tags from objects
##Comment GET / guid=&json= HTML of comments POST / guid=&comment= Add comment to node GET /ID Serialized comment obj POST /ID comment= Updates comment DELETE /ID Deletes comment