Browse files

some minor changes

  • Loading branch information...
1 parent 92f27da commit 7f6fcdf3aaf7c71d51a5679e2c1a6124ba967380 @michiya committed Jul 11, 2012
Showing with 78 additions and 96 deletions.
  1. +6 −6 README.md
  2. +30 −45 WebRole/bin/install-requirements.cmd
  3. +37 −39 WebRole/bin/install.cmd
  4. +3 −5 WebRole/bin/startup.cmd
  5. +2 −1 WebRole/requirements.txt
View
12 README.md
@@ -1,21 +1,21 @@
heliconzoo-django-role
======================
This is a simple scaffold powered by [Helicon Zoo](http://www.helicontech.com/zoo/)
-for packaging Django applications to run on Windows Azure and SQL Azure.
+for packaging Django applications to run on Windows Azure Platform.
Prerequisites
-------------
-You will need to install the following software on your local computer.
+You will need to install the following software on your local computer to make use of this scaffold.
You can use [Web Platform Installer](http://www.microsoft.com/web/downloads/platform.aspx)
to install them easily.
-* Windows Azure SDK
+* Windows Azure SDK 1.6 or higher
* Python 2.7
* Helicon Zoo Module
-* SQL Server Express 2008 R2
+* SQL Server Express 2008 R2 or higher
-And the following Python packages are also required on your Python installation,
+And the following Python packages are also required on your Python installation,
the script `WebRole/bin/install-requirements.cmd` in this scaffold may be helpful
when you install them.
@@ -26,7 +26,7 @@ Usage
-----
1. Create your Django applications into `WebRole/project` directory,
-and add any other Python packages you use to `WebRole/requirements.txt`.
+and add any other Python packages you use to `WebRole/requirements.txt`.
2. Turn IIS feature on and run `run.cmd` on your Windows Azure Command Prompt
to run the application on your local emulator.
View
75 WebRole/bin/install-requirements.cmd
@@ -1,76 +1,61 @@
@echo off
-echo Starting installation of requirements...
-
-REM Helicon Zoo requires Python to be there
-set PYTHON_INSTALL_DIR=%SystemDrive%\Python27
+if not defined PYTHON_INSTALL_DIR set PYTHON_INSTALL_DIR=%SystemDrive%\Python27
REM test installation prerequisites
if not exist %PYTHON_INSTALL_DIR%\python.exe (
echo ERROR: %PYTHON_INSTALL_DIR%\python.exe is missing.
exit /b 1
)
-if not exist %SystemDrive%\Zoo (
-echo ERROR: %SystemDrive%\Zoo is missing.
-exit /b 1
-)
-if "%LOCAL_RESOURCE_TMP_DIR%"=="" set LOCAL_RESOURCE_TMP_DIR=%TMP%
+echo Starting installation of requirements...
+
+if not defined LOCAL_RESOURCE_TMP_DIR set LOCAL_RESOURCE_TMP_DIR=%TMP%
if "%LOCAL_RESOURCE_TMP_DIR:~-1%"=="\" set LOCAL_RESOURCE_TMP_DIR=%LOCAL_RESOURCE_TMP_DIR:~0,-1%
echo temporary download directory is set to [%LOCAL_RESOURCE_TMP_DIR%]
%PYTHON_INSTALL_DIR%\python -c "import sys; print sys.version" | find "64 bit"
set PYTHON_X86=%ERRORLEVEL%
-cd /d "%~dp0"
-
-
-REM install package managers
-:INSTALL_SETUPTOOLS
-echo installing setuptools...
+:INSTALL_DISTRIBUTE
+echo installing distribute...
if exist %PYTHON_INSTALL_DIR%\Scripts\easy_install.exe goto INSTALL_PIP
-powershell -c "(new-object System.Net.WebClient).DownloadFile('http://peak.telecommunity.com/dist/ez_setup.py', '%LOCAL_RESOURCE_TMP_DIR%\easy_setup.py')"
-%PYTHON_INSTALL_DIR%\python %LOCAL_RESOURCE_TMP_DIR%\easy_setup.py
+powershell -c "(new-object System.Net.WebClient).DownloadFile('http://python-distribute.org/distribute_setup.py', '%LOCAL_RESOURCE_TMP_DIR%\distribute_setup.py')
+%PYTHON_INSTALL_DIR%\python %LOCAL_RESOURCE_TMP_DIR%\distribute_setup.py
:INSTALL_PIP
echo installing pip...
-if exist %PYTHON_INSTALL_DIR%\Scripts\pip.exe goto INSTALL_PYODBC
+if exist %PYTHON_INSTALL_DIR%\Scripts\pip.exe goto INSTALL_7ZIP
%PYTHON_INSTALL_DIR%\Scripts\easy_install pip
+:INSTALL_7ZIP
+echo installing 7-Zip...
+set _7ZIP_VERSION=9.20
+set _7ZIP_DIR=7za%_7ZIP_VERSION:.=%
+if exist %LOCAL_RESOURCE_TMP_DIR%\%_7ZIP_DIR%\7za.exe goto INSTALL_GIT
+powershell -c "(new-object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/project/sevenzip/7-Zip/%_7ZIP_VERSION%/%_7ZIP_DIR%.zip', '%LOCAL_RESOURCE_TMP_DIR%\%_7ZIP_DIR%.zip')"
+%PYTHON_INSTALL_DIR%\python -m zipfile -e %LOCAL_RESOURCE_TMP_DIR%\%_7ZIP_DIR%.zip %LOCAL_RESOURCE_TMP_DIR%\%_7ZIP_DIR%
+
+:INSTALL_GIT
+echo installing Git...
+where git >nul 2>nul
+if %ERRORLEVEL% equ 0 goto INSTALL_PYODBC
+set GIT_DIR=PortableGit-1.7.11-preview20120704
+powershell -c "(new-object System.Net.WebClient).DownloadFile('http://msysgit.googlecode.com/files/%GIT_DIR%.7z', '%LOCAL_RESOURCE_TMP_DIR%\%GIT_DIR%.7z')"
+%LOCAL_RESOURCE_TMP_DIR%\%_7ZIP_DIR%\7za x -o%LOCAL_RESOURCE_TMP_DIR%\%GIT_DIR% -y %LOCAL_RESOURCE_TMP_DIR%\%GIT_DIR%.7z
+set PATH=%PATH%;%LOCAL_RESOURCE_TMP_DIR%\%GIT_DIR%\bin
-REM install django-pyodbc
:INSTALL_PYODBC
echo installing pyodbc...
%PYTHON_INSTALL_DIR%\python -c "import pyodbc" 2>nul
-if "%ERRORLEVEL%"=="0" goto INSTALL_DJANGO_PYODBC
-if "%PYTHON_X86%"=="0" goto INSTALL_PYODBC_X64
-%SystemDrive%\Python27\Scripts\easy_install -Z pyodbc==3.0.5
-goto INSTALL_DJANGO_PYODBC
-
-:INSTALL_PYODBC_X64
-set PYODBC_X64_INSTALLER=pyodbc-3.0.2.win-amd64-py2.7.exe
-powershell -c "(new-object System.Net.WebClient).DownloadFile('http://pyodbc.googlecode.com/files/%PYODBC_X64_INSTALLER%', '%LOCAL_RESOURCE_TMP_DIR%\%PYODBC_X64_INSTALLER%')"
-%SystemDrive%\Zoo\Tools\7za x -o%LOCAL_RESOURCE_TMP_DIR%\pyodbc -y %LOCAL_RESOURCE_TMP_DIR%\%PYODBC_X64_INSTALLER%
-xcopy /e /h /y %LOCAL_RESOURCE_TMP_DIR%\pyodbc\PLATLIB\* %PYTHON_INSTALL_DIR%\Lib\site-packages
-
-:INSTALL_DJANGO_PYODBC
-echo installing django-pyodbc...
-%PYTHON_INSTALL_DIR%\python -c "import sql_server.pyodbc" 2>nul
-if "%ERRORLEVEL%"=="0" goto INSTALL_REQUIREMENTS
-set DJANGO_PYODBC_EXTRACT_DIR=%LOCAL_RESOURCE_TMP_DIR%\django-pyodbc
-powershell -c "(new-object System.Net.WebClient).DownloadFile('https://github.com/avidal/django-pyodbc/zipball/django-1.4', '%LOCAL_RESOURCE_TMP_DIR%\django-pyodbc.zip')"
-%SystemDrive%\Zoo\Tools\7za x -o%DJANGO_PYODBC_EXTRACT_DIR% -y %LOCAL_RESOURCE_TMP_DIR%\django-pyodbc.zip
-for /f "usebackq" %%i IN (`dir /b %DJANGO_PYODBC_EXTRACT_DIR%`) do ren %DJANGO_PYODBC_EXTRACT_DIR%\%%i django-pyodbc
-cd /d %DJANGO_PYODBC_EXTRACT_DIR%\django-pyodbc
-%PYTHON_INSTALL_DIR%\python setup.py install
-cd /d "%~dp0"
+if %ERRORLEVEL% equ 0 goto INSTALL_REQUIREMENTS
+%SystemDrive%\Python27\Scripts\easy_install -Z pyodbc==3.0.6
-
-REM install other required python packages
:INSTALL_REQUIREMENTS
echo installing required packages...
-%SystemDrive%\Python27\Scripts\pip install --timeout=600 --default-timeout=600 -r ..\requirements.txt
-
+%SystemDrive%\Python27\Scripts\pip install --timeout=600 --default-timeout=600 -r "%~dp0..\requirements.txt"
echo Finished installation of the requirements.
echo Make sure that you run this command as an administrator if you have any error above.
+
+exit /b
View
76 WebRole/bin/install.cmd
@@ -1,39 +1,37 @@
-@echo off
-
-echo Starting installation...
-
-REM Helicon Zoo requires Python to be there
-set PYTHON_INSTALL_DIR=%SystemDrive%\Python27
-
-if "%LOCAL_RESOURCE_TMP_DIR%"=="" set LOCAL_RESOURCE_TMP_DIR=%TMP%
-if "%LOCAL_RESOURCE_TMP_DIR:~-1%"=="\" set LOCAL_RESOURCE_TMP_DIR=%LOCAL_RESOURCE_TMP_DIR:~0,-1%
-
-cd /d "%~dp0"
-
-md "%~dp0appdata"
-reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d "%~dp0appdata" /f
-
-echo installing Python...
-set PYTHON_VERSION=2.7.3
-set PYTHON_INSTALLER=python-%PYTHON_VERSION%.msi
-if "%1"=="amd64" set PYTHON_INSTALLER=python-%PYTHON_VERSION%.%1.msi
-powershell -c "(new-object System.Net.WebClient).DownloadFile('http://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER%', '%LOCAL_RESOURCE_TMP_DIR%\%PYTHON_INSTALLER%')"
-msiexec /i %LOCAL_RESOURCE_TMP_DIR%\%PYTHON_INSTALLER% /qn TARGET_DIR=%PYTHON_INSTALL_DIR%
-
-echo installing WebPICmdLine...
-set WEBPI_DIR=webpicmdline_anycpu
-set WEBPI_INSTALLER=%WEBPI_DIR%.zip
-powershell -c "(new-object System.Net.WebClient).DownloadFile('http://www.iis.net/community/files/webpi/%WEBPI_INSTALLER%', '%LOCAL_RESOURCE_TMP_DIR%\%WEBPI_INSTALLER%')"
-%PYTHON_INSTALL_DIR%\python -m zipfile -e %LOCAL_RESOURCE_TMP_DIR%\%WEBPI_INSTALLER% %LOCAL_RESOURCE_TMP_DIR%\%WEBPI_DIR%
-
-echo installing Helicon Zoo...
-%LOCAL_RESOURCE_TMP_DIR%\%WEBPI_DIR%\webpicmdline /Products:HeliconZooModule /Feeds:http://www.helicontech.com/zoo/feed/ /AcceptEula
-
-call "%~dp0"install-requirements
-
-REM allow write access to Python runtime for bytecode optimization by Helicon Zoo
-icacls %PYTHON_INSTALL_DIR% /grant "Everyone":F /T
-
-reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d %%USERPROFILE%%\AppData\Local /f
-
-echo Completed installation.
+@echo off
+
+echo Starting installation...
+
+REM Helicon Zoo requires Python to be there
+set PYTHON_INSTALL_DIR=%SystemDrive%\Python27
+
+if "%LOCAL_RESOURCE_TMP_DIR%"=="" set LOCAL_RESOURCE_TMP_DIR=%TMP%
+if "%LOCAL_RESOURCE_TMP_DIR:~-1%"=="\" set LOCAL_RESOURCE_TMP_DIR=%LOCAL_RESOURCE_TMP_DIR:~0,-1%
+
+md "%~dp0appdata"
+reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d "%~dp0appdata" /f
+
+echo installing Python...
+set PYTHON_VERSION=2.7.3
+set PYTHON_INSTALLER=python-%PYTHON_VERSION%.msi
+if "%1"=="amd64" set PYTHON_INSTALLER=python-%PYTHON_VERSION%.%1.msi
+powershell -c "(new-object System.Net.WebClient).DownloadFile('http://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER%', '%LOCAL_RESOURCE_TMP_DIR%\%PYTHON_INSTALLER%')"
+msiexec /i %LOCAL_RESOURCE_TMP_DIR%\%PYTHON_INSTALLER% /qn ALLUSERS=1 TARGET_DIR=%PYTHON_INSTALL_DIR%
+
+echo installing WebPICmdLine...
+set WEBPI_DIR=webpicmdline_anycpu
+set WEBPI_INSTALLER=%WEBPI_DIR%.zip
+powershell -c "(new-object System.Net.WebClient).DownloadFile('http://www.iis.net/community/files/webpi/%WEBPI_INSTALLER%', '%LOCAL_RESOURCE_TMP_DIR%\%WEBPI_INSTALLER%')"
+%PYTHON_INSTALL_DIR%\python -m zipfile -e %LOCAL_RESOURCE_TMP_DIR%\%WEBPI_INSTALLER% %LOCAL_RESOURCE_TMP_DIR%\%WEBPI_DIR%
+
+echo installing Helicon Zoo...
+%LOCAL_RESOURCE_TMP_DIR%\%WEBPI_DIR%\webpicmdline /Products:HeliconZooModule /Feeds:http://www.helicontech.com/zoo/feed/ /AcceptEula
+
+call "%~dp0"install-requirements
+
+REM allow write access to Python installation directory for byte-compiling
+icacls %PYTHON_INSTALL_DIR% /grant "Everyone":F /T
+
+reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d %%USERPROFILE%%\AppData\Local /f
+
+echo Completed installation.
View
8 WebRole/bin/startup.cmd
@@ -1,12 +1,10 @@
@echo off
-cd "%~dp0"
-
icacls %RoleRoot%\approot /grant "Everyone":F /T
-REM This script will only execute on production Windows Azure.
+REM the installer script will only be executed on production Windows Azure.
if "%EMULATED%"=="true" goto :EOF
REM run the command like this if you want to you use Python x64 instead
-REM install.cmd amd64 >..\startup-tasks.log 2>..\startup-tasks-error.log
-install.cmd >..\startup-tasks.log 2>..\startup-tasks-error.log
+REM call install.cmd amd64 >..\startup-tasks.log 2>..\startup-tasks-error.log
+call install.cmd >..\startup-tasks.log 2>..\startup-tasks-error.log
View
3 WebRole/requirements.txt
@@ -1,5 +1,6 @@
-# Add Python modules your project requires here.
+# Add Python modules your project requires here.
# Learn more at http://www.pip-installer.org/en/latest/requirements.html
django
#south
+git+https://github.com/avidal/django-pyodbc.git

0 comments on commit 7f6fcdf

Please sign in to comment.