Skip to content

Commit

Permalink
Merge pull request #42 from nitely/future
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
nitely committed Mar 27, 2015
2 parents 39e6dc2 + d0df9c4 commit 8e22eeb
Show file tree
Hide file tree
Showing 164 changed files with 2,730 additions and 1,467 deletions.
25 changes: 24 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
* text=auto
# Git will handle the files in whatever way it thinks is best
* text=auto

# Always convert line endings to LF on checkout
*.py text eol=lf
*.coffe text eol=lf
*.js text eol=lf
*.scss text eol=lf
*.css text eol=lf
*.html text eol=lf
*.md text eol=lf
*.txt text eol=lf
*.yml text eol=lf
*.po text eol=lf

# Files that are truly binary and should not be modified
*.png binary
*.jpg binary
*.ico binary
*.eot binary
*.svg binary
*.ttf binary
*.woff binary
*.mo binary
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Spirit
spirit/whoosh_index/
db.sqlite3
static/
media/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -34,10 +40,11 @@ htmlcov/
nosetests.xml
coverage.xml

# Mr Developer
# Mr Developer / eclipse pydev
.mr.developer.cfg
.project
.pydevproject
.settings

# Rope
.ropeproject
Expand All @@ -55,4 +62,4 @@ docs/_build/
# Vim
*~
*.swp
*.swo
*.swo
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ python:

install:
- pip install -r requirements.txt --use-mirrors
- pip install coveralls pep8 flake8
- pip install coveralls pep8==1.5.7 flake8
script:
- pep8 --max-line-length=120 --exclude='migrations,tests' .
- flake8 --select=F401 ./spirit
- coverage run --source=. run_tests.py
- flake8 --exit-zero
- ./runtests.py example
- coverage run --source=. runtests.py
after_success:
- coveralls
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Check out the [example](https://github.com/nitely/Spirit/tree/master/example) pr

In short:

Add `url(r'^', include('spirit.urls', namespace="spirit", app_name="spirit")),` to your *urls.py*
Add `url(r'^', include('spirit.urls')),` to your *urls.py*

Add `from spirit.settings import *` to the top of your *settings.py* file,
otherwise you will have to setup all django's related constants (Installed_apps, Middlewares, Login_url, etc)
Expand Down Expand Up @@ -80,6 +80,13 @@ Feel free to check out the source code and submit pull requests.

You may also report any bug or propose new features in the [issues tracker](https://github.com/nitely/Spirit/issues)

## Testing

The `runtests.py` script enable you to run the test suite of spirit.

- Type `./runtests.py` to run the test suite using the settings from the `tests` folder.
- Type `./runtests.py example` to run the test suite using the settings from the `example` folder.

## Copyright / License

Copyright 2014 [Esteban Castro Borsani](https://github.com/nitely).
Expand Down
4 changes: 3 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* >> add @username on reply
* >> allow mods to create topics on closed categories
* >> order profile topics by creation date
* >> accessing custom user attr makes an extra query


Template
Expand All @@ -34,8 +35,9 @@ Template
* admin: add nav to detail templates
* Notifications: show all/unread link
* local store comment publish/update
* topic: like/dislike icon disappears when clicked (js)


Readme
* add note about translations and fuzziness
* update: rebuild_index (search) command
* update: rebuild_index (search) command
26 changes: 26 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#Running the example application

Assuming you use virtualenv, follow these steps to download and run the
Spirit example application in this directory:


$ git clone https://github.com/nitely/Spirit.git
$ cd Spirit
$ virtualenv venv
$ source ./venv/bin/activate
$ pip install .
$ cd example
$ python manage.py migrate
$ python manage.py createcachetable spirit_cache
$ export SECRET_KEY="My dev box"
$ python manage.py runserver

> **Note:**
>
> When running on production, remember to set the SECRET_KEY environment
> variable or use your own setting file to set it.
>
> If you want to give it a quick spin, run `$ python manage.py runserver --settings=project.settings.dev`
You should then be able to open your browser on http://127.0.0.1:8000 and
see the Spirit homepage.
10 changes: 10 additions & 0 deletions example/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings.prod")

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
File renamed without changes.
1 change: 1 addition & 0 deletions example/project/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__author__ = 'Admin'
51 changes: 6 additions & 45 deletions example/settings.py → example/project/settings/base.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,30 @@
# -*- coding: utf-8 -*-
"""
Django settings for test2 project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
Django settings for running the example of spirit app
"""

from __future__ import unicode_literals

import os


# You may override spirit settings below...
import sys

from spirit.settings import *

# You may override spirit settings below...

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)

BASE_DIR = os.path.dirname(os.path.dirname(__file__))
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'change-me'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

TEMPLATE_DEBUG = False

ALLOWED_HOSTS = []


# Application definition

# Extend the Spirit installed apps (notice the plus sign)
# Check out the spirit.settings.py so you do not end up with duplicate apps.
INSTALLED_APPS += (
# 'my_app1',
# 'my_app2',
'debug_toolbar',
)

# same here, check out the spirit.settings.py
Expand All @@ -67,20 +47,9 @@
})


ROOT_URLCONF = 'example.urls'

WSGI_APPLICATION = 'example.wsgi.application'
ROOT_URLCONF = 'project.urls'


# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
WSGI_APPLICATION = 'project.wsgi.application'

# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
Expand All @@ -95,7 +64,6 @@

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

Expand Down Expand Up @@ -133,10 +101,3 @@
},
}
}

try:
# devs must create this file to override settings
# local_settings_sample.py is provided
from .local_settings import *
except ImportError:
pass
44 changes: 44 additions & 0 deletions example/project/settings/dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-

# THIS IS FOR DEVELOPMENT ENVIRONMENT
# DO NOT USE IT IN PRODUCTION

# Create your own dev_local.py
# import * this module there and use it like this:
# python manage.py runserver --settings=project.settings.dev_local

from __future__ import unicode_literals

from .base import *


DEBUG = True

TEMPLATE_DEBUG = True

SECRET_KEY = "DEV"

ALLOWED_HOSTS = ['127.0.0.1', ]

INSTALLED_APPS += (
'debug_toolbar',
)

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

CACHES.update({
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
})

PASSWORD_HASHERS = (
'django.contrib.auth.hashers.MD5PasswordHasher',
)

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@

# MINIMAL CONFIGURATION FOR PRODUCTION ENV

# Create your own prod_local.py
# import * this module there and use it like this:
# python manage.py runserver --settings=project.settings.prod_local

from __future__ import unicode_literals

from .base import *


DEBUG = False

TEMPLATE_DEBUG = False
Expand All @@ -12,11 +19,18 @@
ADMINS = (('John', '[email protected]'), )

# Secret key generator: https://djskgen.herokuapp.com/
SECRET_KEY = ''
# You should set your key as an environ variable
SECRET_KEY = os.environ.get("SECRET_KEY", "")

# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['.example.com', ]

# Extend the Spirit installed apps (notice the plus sign)
# Check out the .base.py file for more examples
INSTALLED_APPS += (
# 'my_app1',
)

# https://docs.djangoproject.com/en/dev/ref/settings/#databases
DATABASES = {
'default': {
Expand All @@ -41,3 +55,11 @@

# Default language
LANGUAGE_CODE = 'en'

# Keep templates in memory
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
)
30 changes: 30 additions & 0 deletions example/project/settings/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-

# THIS IS FOR DEVELOPMENT ENVIRONMENT
# DO NOT USE IT IN PRODUCTION

# This is used to test settings and urls from example directory
# with `./runtests.py example`

from __future__ import unicode_literals

from .base import *

SECRET_KEY = "TEST"

INSTALLED_APPS += (
'tests',
)

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db_test.sqlite3'),
}
}

ROOT_URLCONF = 'example.project.urls'

PASSWORD_HASHERS = (
'django.contrib.auth.hashers.MD5PasswordHasher',
)
2 changes: 1 addition & 1 deletion example/urls.py → example/project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# url(r'^$', 'example.views.home', name='home'),
# url(r'^example/', include('example.foo.urls')),

url(r'^', include('spirit.urls', namespace="spirit", app_name="spirit")),
url(r'^', include('spirit.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
Expand Down
File renamed without changes.
10 changes: 0 additions & 10 deletions example/settings_test_runner.py

This file was deleted.

Loading

0 comments on commit 8e22eeb

Please sign in to comment.