'Deploy App Under Sub-directory - Azure
I have a microservices application in a sub folder of github repository. I am trying to deploy it to Azure.
I found that if I add .deployment
file in my root directory, Azure will automatically deploy the application found under the given path. Here
I have tried the following,
[config]
project = myFlaskProject/helloFlask
Azure build the project successfully, but still it gives me You do not have permission to view this directory or page.
Not sure why, any ideas?
P.S. It works fine if I keep all the application files in my root directory.
Here is the demo testing repository I have made. Hello World Flash Repo
And here is the live demo of the site.
Here are the build logs from Azure,
Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r "D:\home\site\repository" -o "D:\home\site\deployments\tools" --python --sitePath "D:\home\site\repository\flask\helloWorld"'.
The site directory path: .\flask\helloWorld
Generating deployment script for python Web Site
Generated deployment script files
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling python deployment.
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Copying file: 'requirements.txt'
Copying file: 'web.2.7.config'
Copying file: 'web.3.4.config'
Copying file: 'flask\helloWorld\.gitignore'
Copying file: 'flask\helloWorld\index.html'
Copying file: 'flask\helloWorld\LICENSE'
Copying file: 'flask\helloWorld\main.py'
Copying file: 'flask\helloWorld\ptvs_virtualenv_proxy.py'
Copying file: 'flask\helloWorld\README.md'
Copying file: 'flask\helloWorld\requirements.txt'
Copying file: 'flask\helloWorld\web.2.7.config'
Copying file: 'flask\helloWorld\web.3.4.config'
Detected requirements.txt. You can skip Python specific steps with a .skipPythonDeployment file.
Detecting Python runtime from site configuration
Detected python-2.7
Found compatible virtual environment.
Pip install requirements.
Requirement already satisfied (use --upgrade to upgrade): Flask==0.12.1 in d:\home\site\wwwroot\env\lib\site-packages (from -r requirements.txt (line 1))
Cleaning up...
Overwriting web.config with web.2.7.config
1 file(s) copied.
Finished successfully.
Solution 1:[1]
There is a bug in python deployment of Azure. But there is a work around it until they fix it. Read my issue here
Solution 2:[2]
I had similar issue with Spring Rest Controller and I plugged it directly in config eg in yml:
run: mvn clean install -f subDirectory/pom.xml
I am not sure if this is considered best practice but, it worked for me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hafiz Temuri |
Solution 2 | Abraham Bisrat |