diff --git a/README b/README.rest similarity index 68% rename from README rename to README.rest index ca3b5e1..fdb173c 100644 --- a/README +++ b/README.rest @@ -1,11 +1,13 @@ ========================================= ChiShop/DjangoPyPI ========================================= -:Version: 0.1 +:Version: 0.3.0 Installation ============ +Recommended to create a virtualenv for running this. + Install dependencies:: $ python bootstrap.py --distribute @@ -15,9 +17,13 @@ Initial configuration --------------------- :: - $ $EDITOR chishop/settings.py + $ cp chishop/custom_settings.py.example chishop/custom_settings.py + $ $EDITOR chishop/custom_settings.py $ ./bin/django syncdb +You are most likely interested in configuring MEDIA_ROOT and STATIC_ROOT, +although for development they should be fine. + Run the PyPI server ------------------- :: @@ -58,10 +64,17 @@ Add the following to your ``~/.pypirc`` file:: Uploading a package: Python >=2.6 -------------------------------------------- -To push the package to the local pypi:: +To register the package with the local pypi:: + + $ python setup.py register -r local + +To push the package (sdist, bdist_egg, upload executed sequentially) to the local pypi:: + $ python setup.py sdist bdist_egg upload -r local - $ python setup.py register -r local sdist upload -r local +Note, ``bdist_egg`` will fail on old ``distutils``, you should use ``distribute`` that supports it. Otherwise you can stick to uploading ``sdist``. +And installing of course:: + $ pip install -i http://localhost:8000 package Uploading a package: Python <2.6 ------------------------------------------- diff --git a/buildout.cfg b/buildout.cfg index 160db4c..da8e58c 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -4,12 +4,17 @@ find-links = http://bitbucket.org/ubernostrum/django-registration/downloads/djan unzip = true eggs = pkginfo django-registration==0.8-alpha-1 + flup + +[versions] +django = 1.3 [django] recipe = djangorecipe -version = 1.1.1 settings = settings eggs = ${buildout:eggs} test = djangopypi project = chishop wsgi = true +fcgi = true + diff --git a/chishop/conf/default.py b/chishop/conf/default.py index ce43d48..469e0fc 100644 --- a/chishop/conf/default.py +++ b/chishop/conf/default.py @@ -52,7 +52,7 @@ # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" -here = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) +here = os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), '..') MEDIA_ROOT = os.path.join(here, 'media') # URL that handles the media served from MEDIA_ROOT. Make sure to use a @@ -60,18 +60,43 @@ # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = '/media/' +# Absolute path to the directory static files should be collected to. +# Don't put anything in this directory yourself; store your static files +# in apps' "static/" subdirectories and in STATICFILES_DIRS. +# Example: "/home/media/media.lawrence.com/static/" +STATIC_ROOT = os.path.join(here, 'static') + +# URL prefix for static files. +# Example: "http://media.lawrence.com/static/" +STATIC_URL = '/static/' + # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/admin/media/' +# Examples: "http://foo.com/static/admin/", "/static/admin/". +ADMIN_MEDIA_PREFIX = '/static/admin/' + +# Additional locations of static files +STATICFILES_DIRS = ( + # Put strings here, like "/home/html/static" or "C:/www/django/static". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. +) + +# List of finder classes that know how to find static files in +# various locations. +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +# 'django.contrib.staticfiles.finders.DefaultStorageFinder', +) # Make this unique, and don't share it with anybody. SECRET_KEY = 'w_#0r2hh)=!zbynb*gg&969@)sy#^-^ia3m*+sd4@lst$zyaxu' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.load_template_source', - 'django.template.loaders.app_directories.load_template_source', + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.load_template_source', ) @@ -84,11 +109,12 @@ ROOT_URLCONF = 'chishop.urls' TEMPLATE_CONTEXT_PROCESSORS = ( - "django.core.context_processors.auth", + "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.request", + 'django.core.context_processors.static', ) TEMPLATE_DIRS = ( @@ -106,6 +132,7 @@ 'django.contrib.admin', 'django.contrib.markup', 'django.contrib.admindocs', + 'django.contrib.staticfiles', 'registration', - 'djangopypi', + 'chishop.djangopypi', ) diff --git a/chishop/custom_settings.py.example b/chishop/custom_settings.py.example new file mode 100644 index 0000000..ead319e --- /dev/null +++ b/chishop/custom_settings.py.example @@ -0,0 +1,21 @@ +## Custom configuration +# Copy as custom_settings.py and keep outside version control + +import os + +DEBUG = True +TEMPLATE_DEBUG = DEBUG +LOCAL_DEVELOPMENT = True + +if LOCAL_DEVELOPMENT: + import sys + sys.path.append(os.path.dirname(__file__)) + +ADMINS = ( + ('chishop', 'example@example.org'), +) + +MANAGERS = ADMINS + +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + diff --git a/djangopypi/__init__.py b/chishop/djangopypi/__init__.py similarity index 67% rename from djangopypi/__init__.py rename to chishop/djangopypi/__init__.py index b32a761..db26c9a 100644 --- a/djangopypi/__init__.py +++ b/chishop/djangopypi/__init__.py @@ -1,2 +1,2 @@ -VERSION = (0, 2, 0) +VERSION = (0, 3, 0) __version__ = ".".join(map(str, VERSION)) diff --git a/djangopypi/admin.py b/chishop/djangopypi/admin.py similarity index 64% rename from djangopypi/admin.py rename to chishop/djangopypi/admin.py index 6f994e8..37b2dcd 100644 --- a/djangopypi/admin.py +++ b/chishop/djangopypi/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from djangopypi.models import Project, Release, Classifier +from chishop.djangopypi.models import Project, Release, Classifier admin.site.register(Project) admin.site.register(Release) diff --git a/djangopypi/forms.py b/chishop/djangopypi/forms.py similarity index 76% rename from djangopypi/forms.py rename to chishop/djangopypi/forms.py index 6a65d37..afa04af 100644 --- a/djangopypi/forms.py +++ b/chishop/djangopypi/forms.py @@ -1,7 +1,7 @@ import os from django import forms from django.conf import settings -from djangopypi.models import Project, Classifier, Release +from chishop.djangopypi.models import Project, Classifier, Release from django.utils.translation import ugettext_lazy as _ @@ -14,4 +14,4 @@ class Meta: class ReleaseForm(forms.ModelForm): class Meta: model = Release - exclude = ['project'] \ No newline at end of file + exclude = ['project'] diff --git a/djangopypi/http.py b/chishop/djangopypi/http.py similarity index 100% rename from djangopypi/http.py rename to chishop/djangopypi/http.py diff --git a/chishop/media/__init__.py b/chishop/djangopypi/management/__init__.py similarity index 100% rename from chishop/media/__init__.py rename to chishop/djangopypi/management/__init__.py diff --git a/chishop/media/dists/__init__.py b/chishop/djangopypi/management/commands/__init__.py similarity index 100% rename from chishop/media/dists/__init__.py rename to chishop/djangopypi/management/commands/__init__.py diff --git a/djangopypi/management/commands/loadclassifiers.py b/chishop/djangopypi/management/commands/loadclassifiers.py similarity index 97% rename from djangopypi/management/commands/loadclassifiers.py rename to chishop/djangopypi/management/commands/loadclassifiers.py index 49e2642..bd7e3c8 100644 --- a/djangopypi/management/commands/loadclassifiers.py +++ b/chishop/djangopypi/management/commands/loadclassifiers.py @@ -12,7 +12,7 @@ import os.path from django.core.management.base import BaseCommand -from djangopypi.models import Classifier +from chishop.djangopypi.models import Classifier CLASSIFIERS_URL = "http://pypi.python.org/pypi?%3Aaction=list_classifiers" diff --git a/djangopypi/management/commands/ppadd.py b/chishop/djangopypi/management/commands/ppadd.py similarity index 98% rename from djangopypi/management/commands/ppadd.py rename to chishop/djangopypi/management/commands/ppadd.py index aa45274..76a5f43 100644 --- a/djangopypi/management/commands/ppadd.py +++ b/chishop/djangopypi/management/commands/ppadd.py @@ -18,7 +18,7 @@ from urlparse import urlsplit from setuptools.package_index import PackageIndex from django.contrib.auth.models import User -from djangopypi.models import Project, Release, Classifier +from chishop.djangopypi.models import Project, Release, Classifier diff --git a/djangopypi/models.py b/chishop/djangopypi/models.py similarity index 100% rename from djangopypi/models.py rename to chishop/djangopypi/models.py diff --git a/chishop/media/style/djangopypi.css b/chishop/djangopypi/static/style/djangopypi.css similarity index 100% rename from chishop/media/style/djangopypi.css rename to chishop/djangopypi/static/style/djangopypi.css diff --git a/djangopypi/management/__init__.py b/chishop/djangopypi/templatetags/__init__.py similarity index 100% rename from djangopypi/management/__init__.py rename to chishop/djangopypi/templatetags/__init__.py diff --git a/djangopypi/templatetags/safemarkup.py b/chishop/djangopypi/templatetags/safemarkup.py similarity index 100% rename from djangopypi/templatetags/safemarkup.py rename to chishop/djangopypi/templatetags/safemarkup.py diff --git a/djangopypi/tests.py b/chishop/djangopypi/tests.py similarity index 97% rename from djangopypi/tests.py rename to chishop/djangopypi/tests.py index 91682ae..c63ca06 100644 --- a/djangopypi/tests.py +++ b/chishop/djangopypi/tests.py @@ -1,7 +1,7 @@ import unittest import StringIO -from djangopypi.views import parse_distutils_request, simple -from djangopypi.models import Project, Classifier +from chishop.djangopypi.views import parse_distutils_request, simple +from chishop.djangopypi.models import Project, Classifier from django.test.client import Client from django.core.urlresolvers import reverse from django.contrib.auth.models import User @@ -136,4 +136,4 @@ def test_user_registration_with_wrong_data(self): response = simple(request) self.assertEquals(400, response.status_code) - \ No newline at end of file + diff --git a/djangopypi/urls.py b/chishop/djangopypi/urls.py similarity index 93% rename from djangopypi/urls.py rename to chishop/djangopypi/urls.py index 79b16be..9543a4f 100644 --- a/djangopypi/urls.py +++ b/chishop/djangopypi/urls.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from django.conf.urls.defaults import patterns, url, include -urlpatterns = patterns("djangopypi.views", +urlpatterns = patterns("chishop.djangopypi.views", # Simple PyPI url(r'^simple/$', "simple", name="djangopypi-simple"), @@ -21,4 +21,4 @@ name="djangopypi-pypi_show_links"), url(r'^search','search',name='djangopypi-search') -) \ No newline at end of file +) diff --git a/djangopypi/utils.py b/chishop/djangopypi/utils.py similarity index 100% rename from djangopypi/utils.py rename to chishop/djangopypi/utils.py diff --git a/djangopypi/views/__init__.py b/chishop/djangopypi/views/__init__.py similarity index 86% rename from djangopypi/views/__init__.py rename to chishop/djangopypi/views/__init__.py index 1438c54..c7aef13 100644 --- a/djangopypi/views/__init__.py +++ b/chishop/djangopypi/views/__init__.py @@ -2,12 +2,12 @@ from django.shortcuts import render_to_response from django.template import RequestContext -from djangopypi.models import Project, Release -from djangopypi.http import HttpResponseNotImplemented -from djangopypi.http import parse_distutils_request -from djangopypi.views.dists import register_or_upload -from djangopypi.views.users import create_user -from djangopypi.views.search import search +from chishop.djangopypi.models import Project, Release +from chishop.djangopypi.http import HttpResponseNotImplemented +from chishop.djangopypi.http import parse_distutils_request +from chishop.djangopypi.views.dists import register_or_upload +from chishop.djangopypi.views.users import create_user +from chishop.djangopypi.views.search import search ACTIONS = { diff --git a/djangopypi/views/dists.py b/chishop/djangopypi/views/dists.py similarity index 93% rename from djangopypi/views/dists.py rename to chishop/djangopypi/views/dists.py index 9e4a146..4443cde 100644 --- a/djangopypi/views/dists.py +++ b/chishop/djangopypi/views/dists.py @@ -6,9 +6,9 @@ from django.utils.translation import ugettext_lazy as _ from django.contrib.auth import login -from djangopypi.http import login_basic_auth, HttpResponseUnauthorized -from djangopypi.forms import ProjectForm, ReleaseForm -from djangopypi.models import Project, Release, Classifier, UPLOAD_TO +from chishop.djangopypi.http import login_basic_auth, HttpResponseUnauthorized +from chishop.djangopypi.forms import ProjectForm, ReleaseForm +from chishop.djangopypi.models import Project, Release, Classifier, UPLOAD_TO ALREADY_EXISTS_FMT = _( "A file named '%s' already exists for %s. Please create a new release.") diff --git a/djangopypi/views/search.py b/chishop/djangopypi/views/search.py similarity index 94% rename from djangopypi/views/search.py rename to chishop/djangopypi/views/search.py index 5d6a76b..6d82e29 100644 --- a/djangopypi/views/search.py +++ b/chishop/djangopypi/views/search.py @@ -2,7 +2,7 @@ from django.shortcuts import render_to_response from django.db.models.query import Q -from djangopypi.models import Project +from chishop.djangopypi.models import Project def _search_query(q): diff --git a/djangopypi/views/users.py b/chishop/djangopypi/views/users.py similarity index 100% rename from djangopypi/views/users.py rename to chishop/djangopypi/views/users.py diff --git a/chishop/production_example.py b/chishop/production_example.py index b64623e..57ae2f4 100644 --- a/chishop/production_example.py +++ b/chishop/production_example.py @@ -1,4 +1,8 @@ from conf.default import * + +# This imports from the raw settings.py, not Django-enabled settings object +from settings import * + import os DEBUG = False @@ -10,9 +14,12 @@ MANAGERS = ADMINS -DATABASE_ENGINE = 'postgresql_psycopg2' -DATABASE_NAME = 'chishop' -DATABASE_USER = 'chishop' -DATABASE_PASSWORD = 'chishop' -DATABASE_HOST = '' -DATABASE_PORT = '' +DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2' +DATABASES['default']['NAME'] = 'chishop' +DATABASES['default']['USER'] = 'chishop' +DATABASES['default']['PASSWORD'] = 'chishop' + +## These are most likely necessary to override for production +#MEDIA_ROOT = '' +#STATIC_ROOT = '' + diff --git a/chishop/settings.py b/chishop/settings.py index e68a4e5..045c999 100644 --- a/chishop/settings.py +++ b/chishop/settings.py @@ -1,9 +1,9 @@ from conf.default import * import os -DEBUG = True +DEBUG = False TEMPLATE_DEBUG = DEBUG -LOCAL_DEVELOPMENT = True +LOCAL_DEVELOPMENT = False if LOCAL_DEVELOPMENT: import sys @@ -15,9 +15,23 @@ MANAGERS = ADMINS -DATABASE_ENGINE = 'sqlite3' -DATABASE_NAME = os.path.join(here, 'devdatabase.db') -DATABASE_USER = '' -DATABASE_PASSWORD = '' -DATABASE_HOST = '' -DATABASE_PORT = '' +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': os.path.join(here, 'devdatabase.db'), # Or path to database file if using sqlite3. + 'USER': '', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + } +} + +## Easy overriding, eg: +# from settings import DATABASES +# DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2' +try: + # Keep custom_settings.py outside version control to keep things clean + from custom_settings import * +except ImportError, e: + pass + diff --git a/chishop/templates/base.html b/chishop/templates/base.html index 7d30d20..cea254d 100644 --- a/chishop/templates/base.html +++ b/chishop/templates/base.html @@ -2,7 +2,7 @@
- + {% block extrastyle %}{% endblock %}