From 03c273afeb9757a77c84827100e72b604e0123fa Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 27 Dec 2013 12:13:45 +0100 Subject: [PATCH] Django 1.6 Various startproject fixes, --- bin/fnpdjango_bootstrap.sh | 26 ++++++++++++------- fnpdjango/deploy/__init__.py | 15 ++++++----- .../templates/localsettings.py.template | 4 +-- setup.py | 6 ++--- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/bin/fnpdjango_bootstrap.sh b/bin/fnpdjango_bootstrap.sh index 30e9007..fef20de 100755 --- a/bin/fnpdjango_bootstrap.sh +++ b/bin/fnpdjango_bootstrap.sh @@ -2,7 +2,7 @@ # # Use as: # -# source <(curl -L pypi.nowoczesnapolska.org.pl/django) +# source <(curl d.nowoczesnapolska.org.pl) # @@ -11,9 +11,12 @@ PROJECT="$1" # Make it a function, so that it works with `source` start_project() { -DJANGO_REQ='Django>=1.5,<1.6' +DJANGO_REQ='Django>=1.6,<1.7' DJANGO_ROOT='src' + +PYPI='http://pypi.nowoczesnapolska.org.pl/simple' PROJECT_TEMPLATE='http://git.nowoczesnapolska.org.pl/?p=fnpdjango.git;a=snapshot;h=64c636d1e3ff35a7a1d3394fd1d3ff0093f44aa2;sf=tgz' + VIRTUALENVWRAPPER_PATHS=" /etc/bash_completion.d/virtualenvwrapper /usr/bin/virtualenvwrapper.sh @@ -56,26 +59,25 @@ fi echo -e "${strong}Creating virtualenv: $PROJECT...${normal}" mkvirtualenv "$PROJECT" echo -e "${strong}Installing Django...${normal}" -pip install "$DJANGO_REQ" +pip install -i "$PYPI" "$DJANGO_REQ" +pip install -i "$PYPI" --pre django-startproject-plus echo -e "${strong}Starting the project...${normal}" -django-admin.py startproject \ +django-startproject.py \ --template "$PROJECT_TEMPLATE" \ + --name NOTICE \ + --extra_context='{"year": "`date +%Y`"}' \ "$PROJECT" cd "$PROJECT" -WRAPPER="`ls`" -mv "$WRAPPER/"* "$WRAPPER/".gitignore . -rmdir "$WRAPPER" - chmod +x "$DJANGO_ROOT"/manage.py mv "$DJANGO_ROOT/$PROJECT/localsettings.py.dev" "$DJANGO_ROOT/$PROJECT/localsettings.py" echo -e "${strong}Installing requirements...${normal}" -pip install -r requirements.txt +pip install -i "$PYPI" -r requirements.txt echo -e "${strong}Installing developer requirements...${normal}" -pip install -r requirements-dev.txt +pip install -i "$PYPI" -r requirements-dev.txt echo -e "${strong}Running syncdb...${normal}" "$DJANGO_ROOT"/manage.py syncdb --noinput @@ -89,3 +91,7 @@ echo " * Review fabfile, use fab for deployment." } start_project + +# The following is just for displaying it as a webpage:

source <(curl )

+ diff --git a/fnpdjango/deploy/__init__.py b/fnpdjango/deploy/__init__.py index 5428127..0ba4477 100644 --- a/fnpdjango/deploy/__init__.py +++ b/fnpdjango/deploy/__init__.py @@ -51,8 +51,7 @@ def setup(): def check_localsettings(): - if not files.exists('%(app_path)s/localsettings.py' % env): - abort('localsettings.py file missing.') + return files.exists('%(app_path)s/localsettings.py' % env) @task(default=True) @@ -68,7 +67,9 @@ def deploy(): env.release = time.strftime('%Y-%m-%dT%H%M') setup() - check_localsettings() + if not check_localsettings(): + abort('Setup is complete, but\n %(app_path)s/localsettings.py\n' + 'is needed for actual deployment.' % env) upload_tar_from_git() copy_localsettings() install_requirements() @@ -172,9 +173,9 @@ def upload_samples(): for service in env.services: service.upload_sample() -def upload_sample(name): +def upload_sample(name, where="samples/"): require('app_path', 'project_name') - upload_path = '%(app_path)s/samples/' % env + name + '.sample' + upload_path = '%s/%s%s.sample' % (env['app_path'], where, name) if files.exists(upload_path): return print '>>> upload %s template' % name @@ -186,7 +187,7 @@ def upload_sample(name): def upload_localsettings_sample(): "Fill out localsettings template and upload as a sample." env.secret_key = get_random_string(50) - upload_sample('localsettings.py') + upload_sample('localsettings.py', where="") upload_nginx_sample = lambda: upload_sample('nginx') @@ -274,4 +275,4 @@ def get_django_root_path(release): path = '%(app_path)s/releases/%(release)s' % dict(app_path = env['app_path'], release = release) if 'django_root_path' in env: path = join(path, env['django_root_path']) - return path \ No newline at end of file + return path diff --git a/fnpdjango/deploy/templates/localsettings.py.template b/fnpdjango/deploy/templates/localsettings.py.template index 3230579..3cc3916 100644 --- a/fnpdjango/deploy/templates/localsettings.py.template +++ b/fnpdjango/deploy/templates/localsettings.py.template @@ -23,8 +23,8 @@ ALLOWED_HOSTS = ( '%(project_name)s.nowoczesnapolska.org.pl', ) -PIWIK_URL = 'http://piwik.nowoczesnapolska.org.pl/' -PIWIK_TOKEN = '' +PIWIK_URL = '//piwik.nowoczesnapolska.org.pl/nocas/' +PIWIK_SITE_ID = -1 MEDIA_ROOT = '%(app_path)s/media/' STATIC_ROOT = '%(app_path)s/static/' diff --git a/setup.py b/setup.py index d2ac745..3962e6d 100755 --- a/setup.py +++ b/setup.py @@ -22,9 +22,9 @@ def whole_trees(package_dir, paths): setup( name='fnpdjango', - version='0.1.10', + version='0.1.11', author='Radek Czajka', - author_email='radoslaw.czajka@nowoczesnapolska.org.pl', + author_email='radekczajka@nowoczesnapolska.org.pl', url = '', packages=find_packages(), package_data={ @@ -37,7 +37,7 @@ setup( 'bin/fnpdjango_bootstrap.sh', ], install_requires=[ - 'django>=1.4,<1.6', + 'django>=1.4,<1.7', 'textile', ], license='LICENSE', -- 2.20.1