DebugConsole
There is an debug conolse that you can exectue some commands for Django related tasks. The debug console is:
https://{YOUR_PROJECT_NAME}.scm.azurewebsites.net/DebugConsole
Migrate django database in Azure
-
Go to D:\home\site\wwwroot directory
-
Exceute migrate command
D:\home\site\wwwroot> .\env\Scripts\python.exe manage.py migrate
Create super user
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@email.com', 'your_password')" | python manage.py shell
Adjest timezone
Go to azure portal,
Set WEBSITE_TIME_ZONE
to anyvalue defined in here: https://technet.microsoft.com/en-us/library/cc749073(v=ws.10).aspx
Create Django Project
https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-django-app/
-
Create Azure Django App (+ New) >
-
Set
enable git deployment
/ Configcredentials
-
Get git clone url, ex:
https://cm1admin@cm1-django.scm.azurewebsites.net:443/cm1-django.git
-
git push
Set static file
Edit your web.config
in repository root folder:
In the following cases, we map /static
and /uploads
to static
and uploads
in repository
<rewrite>
<rules>
<rule name="Static Files" stopProcessing="true">
<conditions>
<add input="true" pattern="false" />
</conditions>
</rule>
<rule name="Configure Python" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/(static|uploads)/.*" ignoreCase="true" negate="true" />
</conditions>
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>