Commits

Yann Malet  committed 8d2dfd7

Initial directory structure

  • Participants

Comments (0)

Files changed (26)

+*.pyc
+*.egg-info
+bereal/settings/local.py
+bereal/settings/local/*
+docs/_build
+.. 
+
+bereal
+======================
+
+Quickstart
+----------
+
+To bootstrap the project::
+
+    virtualenv bereal
+    source bereal/bin/activate
+    cd path/to/bereal/repository
+    pip install -r requirements.pip
+    pip install -e .
+    cp bereal/settings/local.py.example bereal/settings/local.py
+    manage.py syncdb --migrate
+
+Documentation
+-------------
+
+Developer documentation is available in Sphinx format in the docs directory.
+
+Initial installation instructions (including how to build the documentation as
+HTML) can be found in docs/install.rst.
+package main
+
+import (
+	"log"
+	"net/http"
+	"net/http/httputil"
+	"net/url"
+)
+
+const (
+	STATIC_ROOT string = "/home/yml/Developments/python/bereal/var/static"
+	STATIC_URL string = "/static"
+)
+
+func main() {
+	log.Println("start bereal go server")
+	dstUrl, err := url.Parse("http://127.0.0.1:8000")
+	if err != nil {
+	  log.Fatal(err)
+	}
+
+	http.Handle(STATIC_URL, http.FileServer(http.Dir(STATIC_ROOT)))
+	reverse_proxy := httputil.NewSingleHostReverseProxy(dstUrl)
+	http.Handle("/", reverse_proxy)
+
+	if err = http.ListenAndServe(":8080", nil); err != nil {
+	  log.Fatal(err)
+	}
+}

File bereal/__init__.py

Empty file added.

File bereal/apps/__init__.py

Empty file added.

File bereal/apps/core/__init__.py

Empty file added.

File bereal/apps/core/models.py

+from django.db import models
+
+# Create your models here.

File bereal/apps/core/tests.py

+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.assertEqual(1 + 1, 2)

File bereal/apps/core/urls.py

+from django.conf.urls.defaults import patterns, url, include
+
+from .views import ping, authenticated_ping
+
+urlpatterns = patterns('',
+    url(r'^ping/$', ping, name="core_ping"),
+    url(r'^auth_ping/$', authenticated_ping, name="core_ping"),
+)

File bereal/apps/core/views.py

+from django.http import HttpResponse
+from django.contrib.auth.decorators import login_required
+
+def ping(request):
+    return HttpResponse("pong")
+
+@login_required
+def authenticated_ping(request):
+    return HttpResponse("authenticated pong")

File bereal/apps/realtime/__init__.py

Empty file added.

File bereal/apps/realtime/models.py

+from django.db import models
+
+# Create your models here.

File bereal/apps/realtime/tests.py

+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.assertEqual(1 + 1, 2)

File bereal/apps/realtime/views.py

+# Create your views here.

File bereal/settings/__init__.py

Empty file added.

File bereal/settings/base.py

+"""Base settings shared by all environments"""
+# Import global settings to make it easier to extend settings.
+from django.conf.global_settings import *   # pylint: disable=W0614,W0401
+
+#==============================================================================
+# Generic Django project settings
+#==============================================================================
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+SITE_ID = 1
+# Local time zone for this installation. Choices can be found here:
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+TIME_ZONE = 'UTC'
+USE_TZ = True
+USE_I18N = True
+USE_L10N = True
+LANGUAGE_CODE = 'en'
+LANGUAGES = (
+    ('en', 'English'),
+)
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = 'ynlea(lti9gf+n@=w8jc&^0b4b%&v%@7mam)_qg!e8)61ow641'
+
+INSTALLED_APPS = (
+    # 'bereal.apps.',
+
+    #'south',
+
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+    'django.contrib.admin',
+    'django.contrib.admindocs',
+)
+
+#==============================================================================
+# Calculation of directories relative to the project module location
+#==============================================================================
+
+import os
+import sys
+import bereal as project_module
+
+PROJECT_DIR = os.path.dirname(os.path.realpath(project_module.__file__))
+
+PYTHON_BIN = os.path.dirname(sys.executable)
+ve_path = os.path.dirname(os.path.dirname(os.path.dirname(PROJECT_DIR)))
+# Assume that the presence of 'activate_this.py' in the python bin/
+# directory means that we're running in a virtual environment.
+if os.path.exists(os.path.join(PYTHON_BIN, 'activate_this.py')):
+    # We're running with a virtualenv python executable.
+    VAR_ROOT = os.path.join(os.path.dirname(PYTHON_BIN), 'var')
+elif ve_path and os.path.exists(os.path.join(ve_path, 'bin',
+        'activate_this.py')):
+    # We're running in [virtualenv_root]/src/[project_name].
+    VAR_ROOT = os.path.join(ve_path, 'var')
+else:
+    # Set the variable root to a path in the project which is
+    # ignored by the repository.
+    VAR_ROOT = os.path.join(PROJECT_DIR, 'var')
+
+if not os.path.exists(VAR_ROOT):
+    os.mkdir(VAR_ROOT)
+
+#==============================================================================
+# Project URLS and media settings
+#==============================================================================
+
+ROOT_URLCONF = 'bereal.urls'
+
+LOGIN_URL = '/login/'
+LOGOUT_URL = '/logout/'
+LOGIN_REDIRECT_URL = '/'
+
+STATIC_URL = '/static/'
+MEDIA_URL = '/uploads/'
+
+STATIC_ROOT = os.path.join(VAR_ROOT, 'static')
+MEDIA_ROOT = os.path.join(VAR_ROOT, 'uploads')
+
+STATICFILES_DIRS = (
+    os.path.join(PROJECT_DIR, 'static'),
+)
+
+#==============================================================================
+# Templates
+#==============================================================================
+
+TEMPLATE_DIRS = (
+    os.path.join(PROJECT_DIR, 'templates'),
+)
+
+TEMPLATE_CONTEXT_PROCESSORS += (
+)
+
+#==============================================================================
+# Middleware
+#==============================================================================
+
+MIDDLEWARE_CLASSES += (
+)
+
+#==============================================================================
+# Auth / security
+#==============================================================================
+
+AUTHENTICATION_BACKENDS += (
+)
+
+#==============================================================================
+# Miscellaneous project settings
+#==============================================================================
+
+#==============================================================================
+# Third party app settings
+#==============================================================================

File bereal/settings/dev.py

+"""Settings for Development Server"""
+from bereal.settings.base import *   # pylint: disable=W0614,W0401
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+VAR_ROOT = '/var/www/bereal'
+MEDIA_ROOT = os.path.join(VAR_ROOT, 'uploads')
+STATIC_ROOT = os.path.join(VAR_ROOT, 'static')
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.postgresql_psycopg2',
+        'NAME': 'bereal',
+#        'USER': 'dbuser',
+#        'PASSWORD': 'dbpassword',
+    }
+}
+
+# WSGI_APPLICATION = 'bereal.wsgi.dev.application'

File bereal/static/.gitignore

Empty file added.

File bereal/templates/404.html

+{% extends "base.html" %}
+
+{% block content %}
+    Not Found
+{% endblock %}

File bereal/templates/500.html

+<!DOCTYPE html>
+<html>
+<head>
+    <title>{% block head_title %}{% endblock %}</title>
+    <meta charset="utf-8">
+</head>
+<body>
+
+<div id="container">
+    Server Error
+</div>
+
+</body>
+</html>

File bereal/templates/base.html

+<!DOCTYPE html>
+<html>
+<head>
+    <title>{% block head_title %}{% endblock %}</title>
+    <meta charset="utf-8">
+</head>
+<body>
+
+<div id="container">
+    {% block content %}
+    {% endblock %}
+</div>
+
+</body>
+</html>

File bereal/urls.py

+from django.conf.urls.static import static
+from django.conf import settings
+from django.conf.urls.defaults import patterns, url, include
+
+from django.contrib import admin
+
+admin.autodiscover()
+
+urlpatterns = patterns('',
+    (r'', include('bereal.apps.core.urls')),
+    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
+    (r'^admin/', include(admin.site.urls)),
+)
+
+if settings.DEBUG and settings.MEDIA_ROOT:
+    urlpatterns += static(settings.MEDIA_URL,
+        document_root=settings.MEDIA_ROOT)

File bereal/wsgi.py

+"""
+WSGI config for bereal project.
+
+This module contains the WSGI application used by Django's development server
+and any production WSGI deployments. It should expose a module-level variable
+named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
+this application via the ``WSGI_APPLICATION`` setting.
+
+Usually you will have the standard Django WSGI application here, but it also
+might make sense to replace the whole Django WSGI application with a custom one
+that later delegates to the Django one. For example, you could introduce WSGI
+middleware here, or combine a Django application with an application of another
+framework.
+
+"""
+import os
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE",
+                      "bereal.settings.local")
+
+# This application object is used by any WSGI server configured to use this
+# file. This includes Django's development server, if the WSGI_APPLICATION
+# setting points here.
+from django.core.wsgi import get_wsgi_application
+application = get_wsgi_application()
+
+# Apply WSGI middleware here.
+# from helloworld.wsgi import HelloWorldApplication
+# application = HelloWorldApplication(application)
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == "__main__":
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE",
+        "bereal.settings.local")
+
+    from django.core.management import execute_from_command_line
+
+    execute_from_command_line(sys.argv)

File requirements.pip

+# This file collects all required third-party applications that are needed
+# to run this project. Later you can install all these apps in a row
+# using pip. Example::
+#
+#     pip install -r requirements.pip
+
+django==1.4.1
+#south==0.7.6
+#!/usr/bin/env python
+from setuptools import setup, find_packages
+
+setup(
+    name='bereal',
+    version='1.0',
+    description="",
+    author="Lincoln Loop",
+    author_email='info@lincolnloop.com',
+    url='',
+    packages=find_packages(),
+    package_data={'bereal': ['static/*.*', 'templates/*.*']},
+    scripts=['manage.py'],
+)