Azure Web应用程序间歇地将代码从TMP复制到家中

发布于 2025-02-11 08:30:36 字数 1169 浏览 1 评论 0原文

我正在通过GitHub操作将DJANGO应用程序部署到Azure Web应用程序。该代码始终部署到TMP文件夹,但并不总是复制到wwwroot,即使ORYX部署日志表明复制了内容。是什么导致这种间歇性行为?


Detecting platforms...
Detected following platforms:
  python: 3.8.12

Using intermediate directory '/tmp/8da59cae1f18fde'.

Copying files to the intermediate directory...
Done in 0 sec(s).

Source directory     : /tmp/8da59cae1f18fde
Destination directory: /home/site/wwwroot

Python Version: /opt/python/3.8.12/bin/python3.8
Creating directory for command manifest file if it doesnot exist
Removing existing manifest file
Python Virtual Environment: antenv
Creating virtual environment...
Activating virtual environment...
Running pip install...

Content in source directory is a Django app
Running collectstatic...
Done in 18 sec(s).
Not a vso image, so not writing build commands
Preparing output...

Copying files to destination directory '/tmp/_preCompressedDestinationDir'...
Done in 31 sec(s).
Compressing content of directory '/tmp/_preCompressedDestinationDir'...
Copied the compressed output to '/home/site/wwwroot'

Removing existing manifest file
Creating a manifest file...
Manifest file created.

Done in 244 sec(s).

I am deploying a Django appication to a Azure Web App via Github Actions. The code is consistently deployed to the tmp folder but is not always copied to wwwroot, even though Oryx deployment logs state that the contents are copied. What causes this intermittent behaviour?


Detecting platforms...
Detected following platforms:
  python: 3.8.12

Using intermediate directory '/tmp/8da59cae1f18fde'.

Copying files to the intermediate directory...
Done in 0 sec(s).

Source directory     : /tmp/8da59cae1f18fde
Destination directory: /home/site/wwwroot

Python Version: /opt/python/3.8.12/bin/python3.8
Creating directory for command manifest file if it doesnot exist
Removing existing manifest file
Python Virtual Environment: antenv
Creating virtual environment...
Activating virtual environment...
Running pip install...

Content in source directory is a Django app
Running collectstatic...
Done in 18 sec(s).
Not a vso image, so not writing build commands
Preparing output...

Copying files to destination directory '/tmp/_preCompressedDestinationDir'...
Done in 31 sec(s).
Compressing content of directory '/tmp/_preCompressedDestinationDir'...
Copied the compressed output to '/home/site/wwwroot'

Removing existing manifest file
Creating a manifest file...
Manifest file created.

Done in 244 sec(s).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

下壹個目標 2025-02-18 08:30:36

对于可能在同一问题(特别是在Django应用程序中)苦苦挣扎的其他人

来说wwwroot-但是作为tarball。然后将代码提取到TMP并在此文件夹中执行。这会引起运行Django迁移的挑战,这里没有迁移历史记录。)您无法从wwwroot运行迁移(因为新代码仅存在于tarball中)。因此,为了持续迁移历史记录,您将需要:

  1. 提取output.tar.gz的完整时间以wwwroot和覆盖现有文件。
  2. do 1。一次,为了使您的项目结构准备好在wwwroot中执行迁移,然后此副本 检测数据库更改所需的文件(在我的案例设置中.py,forms.py,models.py和admin.py)可以通过编辑启动命令自动完成。

For others that may be struggling with this same issue, specifically with Django applications, I have landed on the following workaround:

After learning more about how Oryx build actually works, I now understand that the code IS copied to wwwroot - but as a tarball. The code is then extracted to tmp and executed in this folder. This causes a challenge running django migrations as the migration folder is not persistent at the location where the code is run from, i.e. you are not able to run migrations automatically from the tmp folder (because, assuming you are not putting your migrations in source control, there is no migration history here.) and you are not able to run migrations from wwwroot (because the new code only exists in the tarball). So, in order to persist migration history you will need to:

  1. Extract output.tar.gz in its entirety to wwwroot and overwrite existing files.
    OR
  2. Do 1. ONCE in order to get your project structure ready to perform migrations in wwwroot, and after this copy only the files needed to detect database changes (in my case settings.py, forms.py, models.py and admin.py) from tmp to wwwroot. This can be done automatically by editing the startup command.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文