Django 1.6
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Fri, 27 Dec 2013 11:13:45 +0000 (12:13 +0100)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Mon, 30 Dec 2013 12:52:58 +0000 (13:52 +0100)
Various startproject fixes,

bin/fnpdjango_bootstrap.sh
fnpdjango/deploy/__init__.py
fnpdjango/deploy/templates/localsettings.py.template
setup.py

index 30e9007..fef20de 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # Use as: 
 #
 #
 # 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() {
 
 # 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'
 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'
 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
 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}"
 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}"
 
 echo -e "${strong}Starting the project...${normal}"
-django-admin.py startproject \
+django-startproject.py \
     --template "$PROJECT_TEMPLATE" \
     --template "$PROJECT_TEMPLATE" \
+    --name NOTICE \
+    --extra_context='{"year": "`date +%Y`"}' \
     "$PROJECT"
 
 cd "$PROJECT"
 
     "$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}"
 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}"
 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
 
 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
 
 }
 start_project
+
+# The following is just for displaying it as a webpage:<!--
+#--><style>body{white-space:pre;color:#ddd}</style><h1 style="color:#000;text-align:center;position:fixed;top:0;bottom:0;left:0;right:0;white-space:normal">source &lt;(curl <span id="location"></span>)</h1><script>document.getElementById('location').innerHTML=window.location;</script>
+
index 5428127..0ba4477 100644 (file)
@@ -51,8 +51,7 @@ def setup():
 
 
 def check_localsettings():
 
 
 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)
 
 
 @task(default=True)
@@ -68,7 +67,9 @@ def deploy():
     env.release = time.strftime('%Y-%m-%dT%H%M')
 
     setup()
     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()
     upload_tar_from_git()
     copy_localsettings()
     install_requirements()
@@ -172,9 +173,9 @@ def upload_samples():
     for service in env.services:
         service.upload_sample()
 
     for service in env.services:
         service.upload_sample()
 
-def upload_sample(name):
+def upload_sample(name, where="samples/"):
     require('app_path', 'project_name')
     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
     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)
 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')
 
 
 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'])
     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
index 3230579..3cc3916 100644 (file)
@@ -23,8 +23,8 @@ ALLOWED_HOSTS = (
     '%(project_name)s.nowoczesnapolska.org.pl',
 )
 
     '%(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/'
 
 MEDIA_ROOT = '%(app_path)s/media/'
 STATIC_ROOT = '%(app_path)s/static/'
index d2ac745..3962e6d 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -22,9 +22,9 @@ def whole_trees(package_dir, paths):
 
 setup(
     name='fnpdjango',
 
 setup(
     name='fnpdjango',
-    version='0.1.10',
+    version='0.1.11',
     author='Radek Czajka',
     author='Radek Czajka',
-    author_email='radoslaw.czajka@nowoczesnapolska.org.pl',
+    author_email='radekczajka@nowoczesnapolska.org.pl',
     url = '',
     packages=find_packages(),
     package_data={
     url = '',
     packages=find_packages(),
     package_data={
@@ -37,7 +37,7 @@ setup(
         'bin/fnpdjango_bootstrap.sh',
     ],
     install_requires=[
         'bin/fnpdjango_bootstrap.sh',
     ],
     install_requires=[
-        'django>=1.4,<1.6',
+        'django>=1.4,<1.7',
         'textile',
     ],
     license='LICENSE',
         'textile',
     ],
     license='LICENSE',