mirror of
https://github.com/pinry/pinry.git
synced 2025-11-13 08:35:41 +01:00
Added some production settings. Moving to travis-ci for testing. Added feature to stop new registrations.
This commit is contained in:
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,21 +1,11 @@
|
||||
# virtualenv
|
||||
/bin/
|
||||
/lib/
|
||||
/include/
|
||||
/local
|
||||
/Scripts/
|
||||
|
||||
# pip
|
||||
/pip-log.txt
|
||||
/build/
|
||||
|
||||
# django
|
||||
/development.db
|
||||
/media/
|
||||
/static/
|
||||
|
||||
# python
|
||||
*.pyc
|
||||
|
||||
# jenkins
|
||||
/reports/
|
||||
|
||||
8
.travis.yml
Normal file
8
.travis.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
language: python
|
||||
python:
|
||||
- "2.6"
|
||||
- "2.7"
|
||||
# command to install dependencies
|
||||
install: pip install -r requirements.txt
|
||||
# command to run tests
|
||||
script: python manage.py test
|
||||
30
README.md
30
README.md
@@ -1,7 +1,8 @@
|
||||
# 
|
||||
|
||||
Pinry is a private, self-hosted, [Pinterest][0] inspired by [Wookmark][1] and
|
||||
built on top of Django.
|
||||
built on top of Django. Pinry is currently in Alpha/Development, some upgrades
|
||||
may be ugly/not work till I release v1.0.0.
|
||||
|
||||

|
||||
|
||||
@@ -36,38 +37,15 @@ Note: On Ubuntu you can get the build deps by running
|
||||
$ bin/python manage.py runserver
|
||||
|
||||
|
||||
### Jenkins
|
||||
|
||||
If you want to use Pinry with your own Jenkins server I've already setup all of
|
||||
the settings on Pinry, just follow the instructions starting at section 3 on the
|
||||
official [Django Jenkins Tutorial][4].
|
||||
|
||||
A quick tip, when you get to the `Add build step -> Execute shell` step instead
|
||||
of using his example use:
|
||||
|
||||
virtualenv --system-site-packages .
|
||||
bin/pip install -r requirements/jenkins.txt
|
||||
bin/python manage.py jenkins --settings=pinry.settings.jenkins
|
||||
|
||||
As noted in development be sure you have PIL installed or it's build
|
||||
dependencies.
|
||||
|
||||
### Production
|
||||
|
||||
If you want a production server [Google around][2] for more information on
|
||||
running Django in a production environment and create a
|
||||
running Django in a production environment and edit the
|
||||
`pinry/settings/production.py` file. I don't cover this because there are
|
||||
hundreds of different ways to deploy a Django project and everyone has their own
|
||||
preference.
|
||||
|
||||
|
||||
## Build Status
|
||||
|
||||
For build information on the latest commit head over to my [Jenkins server][3].
|
||||
You'll get useful information on if all my tests are passing, my test coverage,
|
||||
and if I'm conforming with pylint and pep8 standards.
|
||||
|
||||
|
||||
## Roadmap
|
||||
|
||||
+ Non-image URL pinning
|
||||
@@ -115,5 +93,3 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
[0]: http://pinterest.com/
|
||||
[1]: http://www.wookmark.com/
|
||||
[2]: https://www.google.com/search?q=deploy+django+production
|
||||
[3]: http://jenkins.bythewood.me/job/pinry/
|
||||
[4]: https://sites.google.com/site/kmmbvnr/home/django-jenkins-tutorial
|
||||
|
||||
@@ -5,6 +5,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth import logout
|
||||
from django.contrib.auth.forms import UserCreationForm
|
||||
from django.contrib import messages
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def home(request):
|
||||
@@ -12,6 +13,10 @@ def home(request):
|
||||
|
||||
|
||||
def register(request):
|
||||
if not settings.ALLOW_NEW_REGISTRATIONS:
|
||||
messages.error(request, "The admin of this service is currently not "
|
||||
"allowing new users to register.")
|
||||
return HttpResponseRedirect(reverse('pins:recent-pins'))
|
||||
if request.method == 'POST':
|
||||
form = UserCreationForm(request.POST)
|
||||
if form.is_valid():
|
||||
@@ -21,6 +26,7 @@ def register(request):
|
||||
return HttpResponseRedirect(reverse('core:login'))
|
||||
else:
|
||||
form = UserCreationForm()
|
||||
|
||||
return TemplateResponse(request, 'core/register.html', {'form': form})
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ from django.contrib.messages import constants as messages
|
||||
|
||||
|
||||
SITE_NAME = 'Pinry'
|
||||
ALLOW_NEW_REGISTRATIONS = True
|
||||
|
||||
|
||||
SITE_ROOT = os.path.join(os.path.realpath(os.path.dirname(__file__)), '../../')
|
||||
@@ -46,7 +47,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'pinry.urls'
|
||||
WSGI_APPLICATION = 'pinry.wsgi.application'
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
INTERNAL_IPS = ['127.0.0.1']
|
||||
MESSAGE_TAGS = {
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
from pinry.settings import *
|
||||
|
||||
import os
|
||||
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(SITE_ROOT, 'development.db'),
|
||||
}
|
||||
}
|
||||
|
||||
SECRET_KEY = ''
|
||||
|
||||
|
||||
INSTALLED_APPS += ('django_jenkins',)
|
||||
PROJECT_APPS = (
|
||||
'pinry.vendor',
|
||||
'pinry.core',
|
||||
'pinry.pins',
|
||||
'pinry.api',
|
||||
)
|
||||
|
||||
|
||||
JENKINS_TASKS = (
|
||||
'django_jenkins.tasks.with_coverage',
|
||||
'django_jenkins.tasks.django_tests',
|
||||
'django_jenkins.tasks.run_pylint',
|
||||
'django_jenkins.tasks.run_pep8',
|
||||
'django_jenkins.tasks.run_pyflakes',
|
||||
)
|
||||
18
pinry/settings/production.py
Normal file
18
pinry/settings/production.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from pinry.settings import *
|
||||
|
||||
import os
|
||||
|
||||
|
||||
DEBUG = False
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
||||
# TODO: I recommend using psycopg2 w/ postgres but sqlite3 is good enough.
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(SITE_ROOT, 'production.db'),
|
||||
}
|
||||
}
|
||||
|
||||
# TODO: Be sure to set this.
|
||||
SECRET_KEY = ''
|
||||
@@ -1,28 +0,0 @@
|
||||
"""
|
||||
WSGI config for pinry 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", "pinry.settings")
|
||||
|
||||
# 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)
|
||||
@@ -1,2 +0,0 @@
|
||||
-r include.txt
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
-r include.txt
|
||||
|
||||
django-jenkins==0.12.1
|
||||
coverage==3.5.2
|
||||
pylint==0.25.1
|
||||
pep8==1.0.1
|
||||
pyflakes==0.5.0
|
||||
|
||||
Reference in New Issue
Block a user