Commit a6ea3966cd92870ea2c5c34f980de556a969cedf
1 parent
69e35926
Exists in
master
and in
5 other branches
Change repository structure, enable pip install
Showing
23 changed files
with
259 additions
and
12 deletions
Show diff stats
| @@ -0,0 +1,75 @@ | @@ -0,0 +1,75 @@ | ||
| 1 | +.. -*- coding: utf-8 -*- | ||
| 2 | + | ||
| 3 | +.. highlight:: rest | ||
| 4 | + | ||
| 5 | +.. _colab_software: | ||
| 6 | + | ||
| 7 | +================================= | ||
| 8 | +Colab-Spb - A Gitlab-Noosfero Connector for the SPB | ||
| 9 | +================================= | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +What is Colab? | ||
| 14 | +============== | ||
| 15 | + | ||
| 16 | +Application that integrates existing systems to represent the contributions of the members through: | ||
| 17 | + | ||
| 18 | +* Discussions at the mailman list. | ||
| 19 | + | ||
| 20 | +* And other systems in the community. | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + | ||
| 24 | +Features | ||
| 25 | +======== | ||
| 26 | + | ||
| 27 | +* Developed by Interlegis Communities http://colab.interlegis.leg.br/ | ||
| 28 | + | ||
| 29 | +* Written in Python http://python.org/ | ||
| 30 | + | ||
| 31 | +* Built with Django Web Framework https://www.djangoproject.com/ | ||
| 32 | + | ||
| 33 | +* Search engine with Solr https://lucene.apache.org/solr/ | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + | ||
| 37 | +Installation | ||
| 38 | +============ | ||
| 39 | + | ||
| 40 | +After installing the colab | ||
| 41 | + | ||
| 42 | +.. code-block:: | ||
| 43 | + | ||
| 44 | + pip install colab-spb | ||
| 45 | + | ||
| 46 | +Create a colab plugin configuration fila with at least the following: | ||
| 47 | + | ||
| 48 | +.. code-block:: | ||
| 49 | + | ||
| 50 | + vim /etc/colab/plugins.d/colab_spb.py | ||
| 51 | + | ||
| 52 | + name='colab_spb' | ||
| 53 | + | ||
| 54 | +Running Colab | ||
| 55 | +============= | ||
| 56 | + | ||
| 57 | +To run Colab with development server you will have to: | ||
| 58 | + | ||
| 59 | +1- Create the example configuration file: | ||
| 60 | + | ||
| 61 | +.. code-block:: | ||
| 62 | + | ||
| 63 | + colab-init-config > /etc/colab/settings.py | ||
| 64 | + | ||
| 65 | +2- Edit the configuration file. Make sure you set everything you need including **database** credentials. | ||
| 66 | + | ||
| 67 | +3- Run the development server: | ||
| 68 | + | ||
| 69 | +.. code-block:: | ||
| 70 | + | ||
| 71 | + colab-admin runserver 0.0.0.0:8000 | ||
| 72 | + | ||
| 73 | + | ||
| 74 | +**NOTE**: In case you want to keep the configuration file else where just set the | ||
| 75 | +desired location in environment variable **COLAB_SETTINGS**. |
__init__.py
admin.py
migrations/__init__.py
models.py
| @@ -0,0 +1,54 @@ | @@ -0,0 +1,54 @@ | ||
| 1 | +import codecs | ||
| 2 | +import os | ||
| 3 | +import re | ||
| 4 | + | ||
| 5 | +from setuptools import setup | ||
| 6 | + | ||
| 7 | +# if you are not using vagrant, just delete os.link directly, | ||
| 8 | +# The hard link only saves a little disk space, so you should not care | ||
| 9 | +if os.environ.get('USER', '') == 'vagrant': | ||
| 10 | + del os.link | ||
| 11 | + | ||
| 12 | +def read(*parts): | ||
| 13 | + return codecs.open(os.path.join(os.path.dirname(__file__), *parts), | ||
| 14 | + encoding='utf8').read() | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +def find_version(*file_paths): | ||
| 18 | + version_file = read(*file_paths) | ||
| 19 | + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", | ||
| 20 | + version_file, re.M) | ||
| 21 | + if version_match: | ||
| 22 | + return version_match.group(1) | ||
| 23 | + raise RuntimeError("Unable to find version string.") | ||
| 24 | + | ||
| 25 | + | ||
| 26 | +setup( | ||
| 27 | + name='colab-spb', | ||
| 28 | + url='https://github.com/colab/colab-spb', | ||
| 29 | + description='Yet another Django reverse proxy application.', | ||
| 30 | + version=find_version('colab_spb/__init__.py'), | ||
| 31 | + long_description=read('README.rst'), | ||
| 32 | + packages=['colab_spb'], | ||
| 33 | + install_requires=[ | ||
| 34 | + 'colab', | ||
| 35 | + ], | ||
| 36 | + tests_require=['mock'], | ||
| 37 | + test_suite="tests.run.runtests", | ||
| 38 | + author='Sergio Oliveira', | ||
| 39 | + author_email='sergio@tracy.com.br', | ||
| 40 | + license='GPL 2.0', | ||
| 41 | + classifiers=[ | ||
| 42 | + 'Development Status :: 3 - Alpha', | ||
| 43 | + 'Environment :: Web Environment', | ||
| 44 | + 'Framework :: Django', | ||
| 45 | + 'Intended Audience :: Developers', | ||
| 46 | + 'Operating System :: OS Independent', | ||
| 47 | + 'Programming Language :: Python', | ||
| 48 | + 'Programming Language :: Python :: 2', | ||
| 49 | + 'Programming Language :: Python :: 2.7', | ||
| 50 | + 'Topic :: Internet :: WWW/HTTP', | ||
| 51 | + 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | ||
| 52 | + 'Topic :: Internet :: WWW/HTTP :: WSGI', | ||
| 53 | + ], | ||
| 54 | +) |
tests.py
| @@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
| 1 | +from django.utils.translation import ugettext_lazy as _ | ||
| 2 | +from colab.plugins.utils.menu import colab_url_factory | ||
| 3 | + | ||
| 4 | +name = 'colab_spb' | ||
| 5 | +verbose_name = 'Spb plugin' | ||
| 6 | + | ||
| 7 | +urls = { | ||
| 8 | + 'include': 'colab_spb.urls', | ||
| 9 | + 'namespace': 'spb', | ||
| 10 | + 'prefix': 'spb', | ||
| 11 | +} | ||
| 12 | + |
| @@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
| 1 | +#!/usr/bin/env python | ||
| 2 | + | ||
| 3 | +import os | ||
| 4 | +import sys | ||
| 5 | + | ||
| 6 | +os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' | ||
| 7 | +os.environ['COLAB_SETTINGS'] = 'tests/config_settings.py' | ||
| 8 | +os.environ['COLAB_YAML_SETTINGS'] = 'tests/settings.yaml' | ||
| 9 | +os.environ['COLAB_PLUGINS'] = 'tests/plugins.d' | ||
| 10 | +os.environ['COVERAGE_PROCESS_START'] = '.coveragerc' | ||
| 11 | +os.environ['REUSE_DB'] = '0' | ||
| 12 | + | ||
| 13 | +import django | ||
| 14 | +import coverage | ||
| 15 | + | ||
| 16 | +from django.test.utils import get_runner | ||
| 17 | +from django.conf import settings | ||
| 18 | + | ||
| 19 | + | ||
| 20 | +def runtests(): | ||
| 21 | + if django.VERSION >= (1, 7, 0): | ||
| 22 | + django.setup() | ||
| 23 | + | ||
| 24 | + test_runner = get_runner(settings) | ||
| 25 | + failures = test_runner(interactive=False, failfast=False).run_tests([]) | ||
| 26 | + sys.exit(failures) | ||
| 27 | + | ||
| 28 | + | ||
| 29 | +def run_with_coverage(): | ||
| 30 | + if os.path.exists('.coverage'): | ||
| 31 | + os.remove('.coverage') | ||
| 32 | + coverage.process_startup() | ||
| 33 | + runtests() | ||
| 34 | + | ||
| 35 | + | ||
| 36 | +if __name__ == '__main__': | ||
| 37 | + run_with_coverage() |
| @@ -0,0 +1,39 @@ | @@ -0,0 +1,39 @@ | ||
| 1 | +from colab.settings import * # noqa | ||
| 2 | + | ||
| 3 | +SOCIAL_NETWORK_ENABLED = True | ||
| 4 | +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' | ||
| 5 | + | ||
| 6 | +LOGGING = { | ||
| 7 | + 'version': 1, | ||
| 8 | + | ||
| 9 | + 'handlers': { | ||
| 10 | + 'null': { | ||
| 11 | + 'level': 'DEBUG', | ||
| 12 | + 'class': 'logging.NullHandler', | ||
| 13 | + }, | ||
| 14 | + }, | ||
| 15 | + | ||
| 16 | + 'loggers': { | ||
| 17 | + 'colab.mailman': { | ||
| 18 | + 'handlers': ['null'], | ||
| 19 | + 'propagate': False, | ||
| 20 | + }, | ||
| 21 | + 'haystack': { | ||
| 22 | + 'handlers': ['null'], | ||
| 23 | + 'propagate': False, | ||
| 24 | + }, | ||
| 25 | + 'pysolr': { | ||
| 26 | + 'handlers': ['null'], | ||
| 27 | + 'propagate': False, | ||
| 28 | + }, | ||
| 29 | + }, | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +import os | ||
| 33 | +HAYSTACK_CONNECTIONS = { | ||
| 34 | + 'default': { | ||
| 35 | + 'ENGINE': 'haystack.backends.solr_backend.SolrEngine', | ||
| 36 | + 'URL': 'http://127.0.0.1:8983/solr' | ||
| 37 | + }, | ||
| 38 | +} | ||
| 39 | + |
views.py