-
Notifications
You must be signed in to change notification settings - Fork 1
Main implementation of Wididit server, using Python and Django. Still not suitable for use.
License
Wididit/Wididit-server
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Wididit is a distributed social network. Check out the doc at <http://doc.wididit.progval.net/>. Dependencies ============ * Python 2 (tested with 2.7) * Django (tested with 2.3) * django_mobile * django-gravatar * The Wididit Python library settings.py =========== Here is what should a base settings.py contain (plus the standard things) TEMPLATE_LOADERS = ( 'django_mobile.loader.Loader', # ... ) TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth', 'django_mobile.context_processors.flavour', 'django.core.context_processors.static', 'wididitserver.views.context_processor', ) MIDDLEWARE_CLASSES = ( # ... 'django_mobile.middleware.MobileDetectionMiddleware', 'django_mobile.middleware.SetFlavourMiddleware', ) INSTALLED_APPS = ( # ... 'django.contrib.markup', 'wididitserver', 'south', 'piston', 'django_mobile', 'gravatar', ) WIDIDIT_HOSTNAME = 'example.com' WIDIDIT_SERVERNAME = 'The name used on the web interface.' PISTON_IGNORE_DUPE_MODELS = True urls.py ======= And a standart urls.py: urlpatterns = patterns('', url(r'', include('wididitserver.urls', namespace='wididit')), (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT, 'show_indexes': True}), ) Don't forget to give the namespace, it is important. If you don't give it, some templates will fail rendering. Web server configuration ======================== Never use the Django development server in production! Apache ------ Here is a sample Apache configuration, using mod_wsgi: <VirtualHost 0.0.0.0:80> ServerName dev.progval.42 DocumentRoot /home/progval/workspace/wididit/server/ WSGIScriptAlias / /home/progval/workspace/wididit/server/django.wsgi Alias /static/admin/ /usr/lib/python2.7/dist-packages/django/contrib/admin/media/ WSGIPassAuthorization On <Directory "/home/progval/workspace/wididit/server/"> Options Indexes MultiViews FollowSymLinks ExecCGI Order allow,deny Allow from all </Directory> <Location /static> SetHandler none </Location> TransferLog /var/log/apache2/dev.progval.42.log </VirtualHost> Don't forget to set `WSGIPassAuthorization on`! If you don't Apache will strip HTTP Authorization headers, and the API will be read only. And the associated django.wsgi file: import os import sys path = '/home/progval/workspace/wididit/server' if path not in sys.path: sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() nginx ----- Here is a sample nginx configuration, using fcgi and UNIX sockets (thanks to the Django doc): server { listen 80; server_name dev.progval.42; location / { # host and port to fastcgi server fastcgi_pass unix:/home/progval/workspace/wididit/server/mysite.sock; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param QUERY_STRING $query_string; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_pass_header Authorization; fastcgi_intercept_errors off; fastcgi_param REMOTE_ADDR $remote_addr; } access_log /var/log/nginx/dev.progval.42.access_log; error_log /var/log/nginx/dev.progval.42.error_log; } And here is a simple bash script to start the FastCGI worker: #!/bin/bash # Replace these three settings. PROJDIR="/home/progval/workspace/wididit/server" PIDFILE="$PROJDIR/mysite.pid" SOCKET="$PROJDIR/mysite.sock" cd $PROJDIR if [ -f $PIDFILE ]; then kill `cat -- $PIDFILE` rm -f -- $PIDFILE echo "Restarting." fi ./manage.py runfcgi --settings=settings pidfile=$PIDFILE socket=$SOCKET
About
Main implementation of Wididit server, using Python and Django. Still not suitable for use.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published