From 7dacbbd5bdba3dfa8b90cf56fd2f87c6767ab778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:09:47 +0000 Subject: [PATCH 01/28] Require latest Django, it would be installed anyway --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c83c08c..a4f26eb 100644 --- a/setup.py +++ b/setup.py @@ -69,7 +69,7 @@ def fullsplit(path, result=None): zip_safe=False, data_files=data_files, install_requires=[ - 'django>=1.0', + 'django>=1.3', 'docutils', 'django-registration>0.7', ], From cd0c1bc14efc4119398d1e3a16b5b4fc22f3c114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:12:17 +0000 Subject: [PATCH 02/28] New-style DATABASES --- chishop/settings.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/chishop/settings.py b/chishop/settings.py index e68a4e5..a85b016 100644 --- a/chishop/settings.py +++ b/chishop/settings.py @@ -15,9 +15,14 @@ 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. + } +} + From 26ebc504528d37171da687b936d9dea071e822f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:16:53 +0000 Subject: [PATCH 03/28] Change settings behaviour slightly, also email to console --- chishop/custom_settings.py.example | 21 +++++++++++++++++++++ chishop/settings.py | 13 +++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 chishop/custom_settings.py.example 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/chishop/settings.py b/chishop/settings.py index a85b016..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 @@ -26,3 +26,12 @@ } } +## 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 + From dd56adfabbc5bfe34cba8aa099ccad24ee8c474c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:22:36 +0000 Subject: [PATCH 04/28] Fix urls --- chishop/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chishop/urls.py b/chishop/urls.py index 5a5dd77..19d4cf2 100644 --- a/chishop/urls.py +++ b/chishop/urls.py @@ -16,7 +16,7 @@ urlpatterns += patterns("", # Admin interface url(r'^admin/doc/', include("django.contrib.admindocs.urls")), - url(r'^admin/(.*)', admin.site.root), + url(r'^admin/', include(admin.site.urls, app_name='admin')), # Registration url(r'^accounts/', include('registration.backends.default.urls')), From 935175665721f667db8ea357b5930d7ec6a0fad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:24:22 +0000 Subject: [PATCH 05/28] Fix DeprecationWarnings --- chishop/conf/default.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chishop/conf/default.py b/chishop/conf/default.py index ce43d48..52bb46a 100644 --- a/chishop/conf/default.py +++ b/chishop/conf/default.py @@ -70,7 +70,7 @@ # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.load_template_source', + 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.load_template_source', # 'django.template.loaders.eggs.load_template_source', ) @@ -84,7 +84,7 @@ 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", From b83ca5d35325e989a83be64ad307bdb737351b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:52:13 +0000 Subject: [PATCH 06/28] Media to static like 1.3 wants it --- chishop/media/__init__.py | 0 chishop/media/dists/__init__.py | 0 {chishop/media => djangopypi/static}/style/djangopypi.css | 0 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 chishop/media/__init__.py delete mode 100644 chishop/media/dists/__init__.py rename {chishop/media => djangopypi/static}/style/djangopypi.css (100%) diff --git a/chishop/media/__init__.py b/chishop/media/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/chishop/media/dists/__init__.py b/chishop/media/dists/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/chishop/media/style/djangopypi.css b/djangopypi/static/style/djangopypi.css similarity index 100% rename from chishop/media/style/djangopypi.css rename to djangopypi/static/style/djangopypi.css From a9f3d9c1e5ff817e5bb1b14f474a73f61c77b1f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:52:33 +0000 Subject: [PATCH 07/28] Move "here" one step down MEDIA_ROOT and STATIC_ROOT should be overridden in custom_settings.py anyway, but this suits development well! --- chishop/conf/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chishop/conf/default.py b/chishop/conf/default.py index 52bb46a..c79e7e7 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 From 026d3a2c9eca41affa735114b7a5038b1c99fc97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:53:24 +0000 Subject: [PATCH 08/28] Enable 1.3 staticfiles --- chishop/conf/default.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/chishop/conf/default.py b/chishop/conf/default.py index c79e7e7..aefa3b3 100644 --- a/chishop/conf/default.py +++ b/chishop/conf/default.py @@ -60,10 +60,35 @@ # 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' @@ -89,6 +114,7 @@ "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', ) From da04eaef1e31042d3d5a1bd6123b822ebd6d7531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:54:01 +0000 Subject: [PATCH 09/28] STATIC_URL, MEDIA_URL is for user uploads! --- chishop/templates/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 %} {% block title %}{% endblock %} From 901e95b0603745bd86ce1e2af40ce56211462fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:54:16 +0000 Subject: [PATCH 10/28] Url for serving static in LOCAL_DEVELOPMENT --- chishop/urls.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chishop/urls.py b/chishop/urls.py index 19d4cf2..ed5bb22 100644 --- a/chishop/urls.py +++ b/chishop/urls.py @@ -13,6 +13,11 @@ url(r"^%s(?P.*)$" % settings.MEDIA_URL[1:], "static.serve", { "document_root": settings.MEDIA_ROOT})) +if settings.LOCAL_DEVELOPMENT: + urlpatterns += patterns('django.contrib.staticfiles.views', + url(r'^static/(?P.*)$', 'serve'), + ) + urlpatterns += patterns("", # Admin interface url(r'^admin/doc/', include("django.contrib.admindocs.urls")), From 74396902c5fa9f35af8c814a9f1fee89d1a109ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:54:59 +0000 Subject: [PATCH 11/28] djangopypi is an application, it goes under a project --- {djangopypi => chishop/djangopypi}/__init__.py | 0 {djangopypi => chishop/djangopypi}/admin.py | 0 {djangopypi => chishop/djangopypi}/forms.py | 0 {djangopypi => chishop/djangopypi}/http.py | 0 {djangopypi => chishop/djangopypi}/management/__init__.py | 0 .../djangopypi}/management/commands/__init__.py | 0 .../djangopypi}/management/commands/loadclassifiers.py | 0 {djangopypi => chishop/djangopypi}/management/commands/ppadd.py | 0 {djangopypi => chishop/djangopypi}/models.py | 0 {djangopypi => chishop/djangopypi}/static/style/djangopypi.css | 0 {djangopypi => chishop/djangopypi}/templatetags/__init__.py | 0 {djangopypi => chishop/djangopypi}/templatetags/safemarkup.py | 0 {djangopypi => chishop/djangopypi}/tests.py | 0 {djangopypi => chishop/djangopypi}/urls.py | 0 {djangopypi => chishop/djangopypi}/utils.py | 0 {djangopypi => chishop/djangopypi}/views/__init__.py | 0 {djangopypi => chishop/djangopypi}/views/dists.py | 0 {djangopypi => chishop/djangopypi}/views/search.py | 0 {djangopypi => chishop/djangopypi}/views/users.py | 0 19 files changed, 0 insertions(+), 0 deletions(-) rename {djangopypi => chishop/djangopypi}/__init__.py (100%) rename {djangopypi => chishop/djangopypi}/admin.py (100%) rename {djangopypi => chishop/djangopypi}/forms.py (100%) rename {djangopypi => chishop/djangopypi}/http.py (100%) rename {djangopypi => chishop/djangopypi}/management/__init__.py (100%) rename {djangopypi => chishop/djangopypi}/management/commands/__init__.py (100%) rename {djangopypi => chishop/djangopypi}/management/commands/loadclassifiers.py (100%) rename {djangopypi => chishop/djangopypi}/management/commands/ppadd.py (100%) rename {djangopypi => chishop/djangopypi}/models.py (100%) rename {djangopypi => chishop/djangopypi}/static/style/djangopypi.css (100%) rename {djangopypi => chishop/djangopypi}/templatetags/__init__.py (100%) rename {djangopypi => chishop/djangopypi}/templatetags/safemarkup.py (100%) rename {djangopypi => chishop/djangopypi}/tests.py (100%) rename {djangopypi => chishop/djangopypi}/urls.py (100%) rename {djangopypi => chishop/djangopypi}/utils.py (100%) rename {djangopypi => chishop/djangopypi}/views/__init__.py (100%) rename {djangopypi => chishop/djangopypi}/views/dists.py (100%) rename {djangopypi => chishop/djangopypi}/views/search.py (100%) rename {djangopypi => chishop/djangopypi}/views/users.py (100%) diff --git a/djangopypi/__init__.py b/chishop/djangopypi/__init__.py similarity index 100% rename from djangopypi/__init__.py rename to chishop/djangopypi/__init__.py diff --git a/djangopypi/admin.py b/chishop/djangopypi/admin.py similarity index 100% rename from djangopypi/admin.py rename to chishop/djangopypi/admin.py diff --git a/djangopypi/forms.py b/chishop/djangopypi/forms.py similarity index 100% rename from djangopypi/forms.py rename to chishop/djangopypi/forms.py 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/djangopypi/management/__init__.py b/chishop/djangopypi/management/__init__.py similarity index 100% rename from djangopypi/management/__init__.py rename to chishop/djangopypi/management/__init__.py diff --git a/djangopypi/management/commands/__init__.py b/chishop/djangopypi/management/commands/__init__.py similarity index 100% rename from djangopypi/management/commands/__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 100% rename from djangopypi/management/commands/loadclassifiers.py rename to chishop/djangopypi/management/commands/loadclassifiers.py diff --git a/djangopypi/management/commands/ppadd.py b/chishop/djangopypi/management/commands/ppadd.py similarity index 100% rename from djangopypi/management/commands/ppadd.py rename to chishop/djangopypi/management/commands/ppadd.py 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/djangopypi/static/style/djangopypi.css b/chishop/djangopypi/static/style/djangopypi.css similarity index 100% rename from djangopypi/static/style/djangopypi.css rename to chishop/djangopypi/static/style/djangopypi.css diff --git a/djangopypi/templatetags/__init__.py b/chishop/djangopypi/templatetags/__init__.py similarity index 100% rename from djangopypi/templatetags/__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 100% rename from djangopypi/tests.py rename to chishop/djangopypi/tests.py diff --git a/djangopypi/urls.py b/chishop/djangopypi/urls.py similarity index 100% rename from djangopypi/urls.py rename to chishop/djangopypi/urls.py 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 100% rename from djangopypi/views/__init__.py rename to chishop/djangopypi/views/__init__.py diff --git a/djangopypi/views/dists.py b/chishop/djangopypi/views/dists.py similarity index 100% rename from djangopypi/views/dists.py rename to chishop/djangopypi/views/dists.py diff --git a/djangopypi/views/search.py b/chishop/djangopypi/views/search.py similarity index 100% rename from djangopypi/views/search.py rename to chishop/djangopypi/views/search.py 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 From 35224237a39d95a0f86fdd0a7213a99ec8be63c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 09:58:41 +0000 Subject: [PATCH 12/28] csrf_tokens in forms --- chishop/templates/djangopypi/search.html | 1 + chishop/templates/registration/login.html | 1 + chishop/templates/registration/registration_form.html | 1 + 3 files changed, 3 insertions(+) diff --git a/chishop/templates/djangopypi/search.html b/chishop/templates/djangopypi/search.html index a638a94..0d2e5ef 100644 --- a/chishop/templates/djangopypi/search.html +++ b/chishop/templates/djangopypi/search.html @@ -1,4 +1,5 @@
+ {% csrf_token %}
diff --git a/chishop/templates/registration/login.html b/chishop/templates/registration/login.html index 6c7f799..cbf8842 100644 --- a/chishop/templates/registration/login.html +++ b/chishop/templates/registration/login.html @@ -2,6 +2,7 @@ {% block content %}
+ {% csrf_token %} {{form.as_p}}
diff --git a/chishop/templates/registration/registration_form.html b/chishop/templates/registration/registration_form.html index 719a875..ebec1c5 100644 --- a/chishop/templates/registration/registration_form.html +++ b/chishop/templates/registration/registration_form.html @@ -3,6 +3,7 @@ {% block content %}

Register

+ {% csrf_token %} {{form.as_p}} {% endblock %} From 8b964945bd794025f75c55feb376dc5ab50bfe31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 10:02:43 +0000 Subject: [PATCH 13/28] production_example.py updated --- chishop/production_example.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/chishop/production_example.py b/chishop/production_example.py index b64623e..efe64ad 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,8 @@ 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' + From 8d951c67d8d9731f12f7dc37d966997af6e6af57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 10:03:58 +0000 Subject: [PATCH 14/28] README.rest --- README => README.rest | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => README.rest (100%) diff --git a/README b/README.rest similarity index 100% rename from README rename to README.rest From cf5a82e374504a230026413def15760376adc14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 10:24:17 +0000 Subject: [PATCH 15/28] Update buildout.cfg, support [versions] block --- buildout.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildout.cfg b/buildout.cfg index 160db4c..9515f4f 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -5,9 +5,11 @@ unzip = true eggs = pkginfo django-registration==0.8-alpha-1 +[versions] +django = 1.3 + [django] recipe = djangorecipe -version = 1.1.1 settings = settings eggs = ${buildout:eggs} test = djangopypi From a02fb6a22c190c770c856272fefbd0fdd59f402c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 10:33:52 +0000 Subject: [PATCH 16/28] README.rest in setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a4f26eb..a119a95 100644 --- a/setup.py +++ b/setup.py @@ -84,5 +84,5 @@ def fullsplit(path, result=None): "Topic :: System :: Software Distribution", "Programming Language :: Python", ], - long_description=codecs.open('README', "r", "utf-8").read(), + long_description=codecs.open('README.rest', "r", "utf-8").read(), ) From 1ad685ed59ae1bc266cd73d20fcf0bb00cc4fe59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 11:13:20 +0000 Subject: [PATCH 17/28] app_directories.Loader --- chishop/conf/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chishop/conf/default.py b/chishop/conf/default.py index aefa3b3..79a1351 100644 --- a/chishop/conf/default.py +++ b/chishop/conf/default.py @@ -96,7 +96,7 @@ # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.load_template_source', + 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.load_template_source', ) From a9158ab0b1926c813cfc51fcababca0c3c7de7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 11:37:26 +0000 Subject: [PATCH 18/28] Install application with path --- chishop/conf/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chishop/conf/default.py b/chishop/conf/default.py index 79a1351..469e0fc 100644 --- a/chishop/conf/default.py +++ b/chishop/conf/default.py @@ -134,5 +134,5 @@ 'django.contrib.admindocs', 'django.contrib.staticfiles', 'registration', - 'djangopypi', + 'chishop.djangopypi', ) From 3f3b742ea44f65ada612f17df87f5e341c3688e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 11:51:34 +0000 Subject: [PATCH 19/28] Commented-out comment on *_ROOT --- chishop/production_example.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chishop/production_example.py b/chishop/production_example.py index efe64ad..57ae2f4 100644 --- a/chishop/production_example.py +++ b/chishop/production_example.py @@ -19,3 +19,7 @@ DATABASES['default']['USER'] = 'chishop' DATABASES['default']['PASSWORD'] = 'chishop' +## These are most likely necessary to override for production +#MEDIA_ROOT = '' +#STATIC_ROOT = '' + From 78e00eeaf47eb9267e2749000e5bcfa526637b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 12:08:09 +0000 Subject: [PATCH 20/28] Update README.rest slightly --- README.rest | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.rest b/README.rest index ca3b5e1..5a9c2d4 100644 --- a/README.rest +++ b/README.rest @@ -6,6 +6,8 @@ ChiShop/DjangoPyPI 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 ------------------- :: From 2de5f94a80059dcc5551f7e25ac438ff8be44f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 12:33:23 +0000 Subject: [PATCH 21/28] fcgi --- buildout.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildout.cfg b/buildout.cfg index 9515f4f..da8e58c 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -4,6 +4,7 @@ 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 @@ -15,3 +16,5 @@ eggs = ${buildout:eggs} test = djangopypi project = chishop wsgi = true +fcgi = true + From 6faf7a2fd8161b3e3a7f3e605a925108fb2e109e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 13:52:04 +0000 Subject: [PATCH 22/28] Fix import path in admin --- chishop/djangopypi/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chishop/djangopypi/admin.py b/chishop/djangopypi/admin.py index 6f994e8..37b2dcd 100644 --- a/chishop/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) From af09c4d53d540483d355adfd582420ceda28748a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 13:55:57 +0000 Subject: [PATCH 23/28] Include urls by complete path --- chishop/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chishop/urls.py b/chishop/urls.py index ed5bb22..f0b6ced 100644 --- a/chishop/urls.py +++ b/chishop/urls.py @@ -27,5 +27,5 @@ url(r'^accounts/', include('registration.backends.default.urls')), # The Chishop - url(r'', include("djangopypi.urls")) + url(r'', include("chishop.djangopypi.urls")) ) From 1a9e17891bb11dff4a781c86bc6f5901d0bb7f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 13:59:24 +0000 Subject: [PATCH 24/28] chishop.djangopypi --- chishop/djangopypi/urls.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chishop/djangopypi/urls.py b/chishop/djangopypi/urls.py index 79b16be..9543a4f 100644 --- a/chishop/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 +) From 5d2dc30878b11d2db36ff4ef8c47b50c4967388a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 14:01:59 +0000 Subject: [PATCH 25/28] Views import fixes --- chishop/djangopypi/views/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/chishop/djangopypi/views/__init__.py b/chishop/djangopypi/views/__init__.py index 1438c54..c7aef13 100644 --- a/chishop/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 = { From 09c55269b175a412950d484c97457aaff90745a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 14:13:11 +0000 Subject: [PATCH 26/28] Massive import changes --- chishop/djangopypi/forms.py | 4 ++-- chishop/djangopypi/management/commands/loadclassifiers.py | 2 +- chishop/djangopypi/management/commands/ppadd.py | 2 +- chishop/djangopypi/tests.py | 6 +++--- chishop/djangopypi/views/dists.py | 6 +++--- chishop/djangopypi/views/search.py | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/chishop/djangopypi/forms.py b/chishop/djangopypi/forms.py index 6a65d37..afa04af 100644 --- a/chishop/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/chishop/djangopypi/management/commands/loadclassifiers.py b/chishop/djangopypi/management/commands/loadclassifiers.py index 49e2642..bd7e3c8 100644 --- a/chishop/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/chishop/djangopypi/management/commands/ppadd.py b/chishop/djangopypi/management/commands/ppadd.py index aa45274..76a5f43 100644 --- a/chishop/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/chishop/djangopypi/tests.py b/chishop/djangopypi/tests.py index 91682ae..c63ca06 100644 --- a/chishop/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/chishop/djangopypi/views/dists.py b/chishop/djangopypi/views/dists.py index 9e4a146..4443cde 100644 --- a/chishop/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/chishop/djangopypi/views/search.py b/chishop/djangopypi/views/search.py index 5d6a76b..6d82e29 100644 --- a/chishop/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): From 20984bc9cbb84ec36b3bb06c24ae2e42d4ba5d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 15:47:48 +0000 Subject: [PATCH 27/28] Bump version ;) --- README.rest | 2 +- chishop/djangopypi/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rest b/README.rest index 5a9c2d4..6a93472 100644 --- a/README.rest +++ b/README.rest @@ -1,7 +1,7 @@ ========================================= ChiShop/DjangoPyPI ========================================= -:Version: 0.1 +:Version: 0.3.0 Installation ============ diff --git a/chishop/djangopypi/__init__.py b/chishop/djangopypi/__init__.py index b32a761..db26c9a 100644 --- a/chishop/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)) From edfc8e8589d734205598b8480dc579476c5f53f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20T=C3=B6rnqvist?= Date: Tue, 23 Aug 2011 16:28:05 +0000 Subject: [PATCH 28/28] Update readme wrt setup.py etc --- README.rest | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.rest b/README.rest index 6a93472..fdb173c 100644 --- a/README.rest +++ b/README.rest @@ -64,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 -------------------------------------------