- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
对于所有受支持的数据库后端,遵循 JSONField
的 Django 3.1
指南... https://docs.djangoproject.com/en/3.1/releases/3.1/#jsonfield-for-all-supported-database-backends
WARNINGS:
users.Search.input: (fields.W904) django.contrib.postgres.fields.JSONField is deprecated. Support for it (except in historical migrations) will be removed in Django 4.0.
HINT: Use django.db.models.JSONField instead.
from django.db import models
class ContactInfo(models.Model):
data = models.JSONField()
…最终在 Azure Web App
上出现错误:
AttributeError: module 'django.db.models' has no attribute 'JSONField'
Requirements.txt
文件指定 Django >= 3.1:
Django >= 3.1
应用服务构建
控制台:
##[group]Run azure/appservice-build@v1
with:
platform: python
platform-version: 3.8
env:
pythonLocation: /opt/hostedtoolcache/Python/3.8.5/x64
...
No source directory was provided -- the root of the repository ('GITHUB_WORKSPACE' environment variable) will be built: '/github/workspace'
No output directory was provided
Platform provided: 'python'
Platform version provided: '3.8'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 131 100 131 0 0 262 0 --:--:-- --:--:-- --:--:-- 262
100 131 100 131 0 0 262 0 --:--:-- --:--:-- --:--:-- 262
Running command 'oryx build /github/workspace --platform python --platform-version 3.8 --enable-dynamic-install'
Build orchestrated by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues
Oryx Version : 0.2.20200312.2, Commit: d1cf6b4a89345b6a7d0dc25d0fbd67860862ee18, ReleaseTagName: 20200312.2
Build Operation ID: |xt2zaWLFTwY=.5ad82150_
Repository Commit : 75be0048ee098cbf42a032200e6ef6867a48b924
Source directory : /github/workspace
Destination directory: /github/workspace
Python Version: /opt/python/3.8.2/bin/python3
Python Virtual Environment: pythonenv3.8
Creating virtual environment ...
Activating virtual environment ...
Upgrading pip...
WARNING: The directory '/github/home/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
Downloading https://files.pythonhosted.org/packages/4e/5f/528232275f6509b1fff703c9280e58951a81abe24640905de621c9f81839/pip-20.2.3-py2.py3-none-any.whl (1.5MB)
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Successfully installed pip-20.2.3
Done in 2 sec(s).
Running pip install...
Collecting Django>=3.1
Downloading Django-3.1.1-py3-none-any.whl (7.8 MB)
Collecting psycopg2-binary
Downloading psycopg2_binary-2.8.6-cp38-cp38-manylinux1_x86_64.whl (3.0 MB)
...
Building wheels for collected packages: isort
Building wheel for isort (PEP 517): started
Building wheel for isort (PEP 517): finished with status 'done'
Created wheel for isort: filename=isort-5.5.2-py3-none-any.whl size=96676 sha256=51272461d0c723dd22ff1a2f9eeb14b85dcb526eb89afaeaa56a444601358acd
Stored in directory: /tmp/pip-ephem-wheel-cache-2s_h_h49/wheels/1e/39/35/2df4c05d92066f85f187318ea94000afe7a684a28361f823cb
Successfully built isort
...
Successfully installed Django-3.1.1 PyJWT-1.7.1 apscheduler-3.6.3 asgiref-3.2.10 astroid-2.4.2 azure-common-1.1.25 azure-core-1.8.1 azure-identity-1.0.1 azure-keyvault-secrets-4.0.0 cachetools-4.1.1 certifi-2020.6.20 cffi-1.14.2 chardet-3.0.4 click-7.1.2 cryptography-3.1 defusedxml-0.6.0 diff-match-patch-20200713 django-apscheduler-0.3.0 django-braces-1.14.0 django-cas-ng-4.1.1 django-crispy-forms-1.9.2 django-debug-toolbar-2.2 django-import-export-2.3.0 django-money-1.1 django-pandas-0.6.2 et-xmlfile-1.0.1 google-api-core-1.22.2 google-auth-1.21.1 googleapis-common-protos-1.52.0 googletrans-3.0.0 h11-0.9.0 h2-3.2.0 hpack-3.0.0 hstspreload-2020.9.9 httpcore-0.9.1 httpx-0.13.3 hyperframe-5.2.0 idna-2.10 isodate-0.6.0 isort-5.5.2 jdcal-1.4.1 joblib-0.16.0 lazy-object-proxy-1.4.3 lxml-4.5.2 markuppy-1.14 mccabe-0.6.1 msal-1.5.0 msal-extensions-0.1.3 msrest-0.6.19 nltk-3.5 numpy-1.19.2 oauthlib-3.1.0 odfpy-1.4.1 opencensus-0.7.10 opencensus-context-0.1.1 opencensus-ext-azure-1.0.4 opencensus-ext-django-0.7.2 opencensus-ext-logging-0.1.0 opencensus-ext-postgresql-0.1.2 openpyxl-3.0.5 pandas-1.1.2 portalocker-1.7.1 protobuf-3.13.0 psutil-5.7.2 psycopg2-binary-2.8.6 py-moneyed-0.8.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.20 pylint-2.6.0 python-cas-1.5.0 python-dateutil-2.8.1 python-docx-0.8.10 pytz-2020.1 pyyaml-5.3.1 rake-nltk-1.0.4 regex-2020.7.14 requests-2.24.0 requests-oauthlib-1.3.0 rfc3986-1.4.0 rsa-4.6 scikit-learn-0.23.2 scipy-1.5.2 six-1.15.0 sniffio-1.1.0 sqlparse-0.3.1 tablib-2.0.0 threadpoolctl-2.1.0 toml-0.10.1 tqdm-4.49.0 tzlocal-2.1 urllib3-1.25.10 whitenoise-5.2.0 wrapt-1.12.1 xlrd-1.2.0 xlwt-1.3.0
Done running pip install.
Content in source directory is a Django app
Running collectstatic ...
248 static files copied to '/github/workspace/staticfiles', 614 post-processed.
'collectstatic' exited with exit code .
Done in 3 sec(s).
Removing existing manifest file
Creating a manifest file...
Manifest file created.
Done in 65 sec(s).
Oryx
控制台:
INFO - Starting container for site
INFO - docker run -d -p 2747:8000 --name azapp-rio-analyse-k6xbl__6cdd_0_ee823bd7 -e WEBSITE_SITE_NAME=azapp-rio-analyse-k6xbl -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=azapp-rio-analyse-k6xbl-dev.azurewebsites.net -e WEBSITE_INSTANCE_ID=945195e1f60010c33c817fd7ae1c28de08dc486224321f51d599531c29bb5725 -e HTTP_LOGGING_ENABLED=1 appsvc/python:3.8_20200707.6
INFO - Initiating warmup request to container azapp-rio-analyse-k6xbl__6cdd_0_ee823bd7_msiProxy for site azapp-rio-analyse-k6xbl__6cdd
INFO - Container azapp-rio-analyse-k6xbl__6cdd_0_ee823bd7_msiProxy for site azapp-rio-analyse-k6xbl__6cdd initialized successfully and is ready to serve requests.
INFO - Initiating warmup request to container azapp-rio-analyse-k6xbl__6cdd_0_ee823bd7 for site azapp-rio-analyse-k6xbl__6cdd
_____
/ _ \ __________ _________ ____
/ /_\ \___ / | \_ __ \_/ __ \
/ | \/ /| | /| | \/\ ___/
\____|__ /_____ \____/ |__| \___ >
\/ \/ \/
A P P S E R V I C E O N L I N U X
Documentation: http://aka.ms/webapp-linux
Python 3.8.3
Note: Any data outside '/home' is not persisted
Starting OpenBSD Secure Shell server: sshd.
App Command Line not configured, will attempt auto-detect
Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite
Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it...
Build Operation ID: |mt6xPWP5VVs=.cc9e7dda_
Oryx Version: 0.2.20200706.2, Commit: 42be45d884938c3c818ba08e9e4760b1136fd9b3, ReleaseTagName: 20200706.2
Detected an app based on Django
Generating `gunicorn` command for 'main.wsgi'
Writing output script to '/opt/startup/startup.sh'
Using packages from virtual environment pythonenv3.8 located at /home/site/wwwroot/pythonenv3.8.
Updated PYTHONPATH to ':/home/site/wwwroot/pythonenv3.8/lib/python3.8/site-packages'
[2020-09-13 16:29:57 +0000] [37] [INFO] Starting gunicorn 20.0.4
[2020-09-13 16:29:57 +0000] [37] [INFO] Listening at: http://0.0.0.0:8000 (37)
[2020-09-13 16:29:57 +0000] [37] [INFO] Using worker: sync
[2020-09-13 16:29:57 +0000] [39] [INFO] Booting worker with pid: 39
INFO:opencensus.ext.postgresql.trace:Integrated module: postgresql
[2020-09-13 18:30:13 +0200] [39] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/opt/python/3.8.3/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/opt/python/3.8.3/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/opt/python/3.8.3/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/opt/python/3.8.3/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/opt/python/3.8.3/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/opt/python/3.8.3/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/opt/python/3.8.3/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/opt/python/3.8.3/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/site/wwwroot/main/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/home/site/wwwroot/django/core/wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "/home/site/wwwroot/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/site/wwwroot/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/home/site/wwwroot/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/opt/python/3.8.3/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/site/wwwroot/users/models.py", line 25, in <module>
class ContactInfo(models.Model):
File "/home/site/wwwroot/users/models.py", line 29, in Search
data = models.JSONField(encoder=DjangoJSONEncoder, null=True, db_index=True)
AttributeError: module 'django.db.models' has no attribute 'JSONField'
[2020-09-13 18:30:13 +0200] [39] [INFO] Worker exiting (pid: 39)
[2020-09-13 16:30:13 +0000] [37] [INFO] Shutting down: Master
[2020-09-13 16:30:13 +0000] [37] [INFO] Reason: Worker failed to boot.
ERROR - Container azapp-rio-analyse-k6xbl__6cdd_0_ee823bd7 for site azapp-rio-analyse-k6xbl__6cdd has exited, failing site start
ERROR - Container azapp-rio-analyse-k6xbl__6cdd_0_ee823bd7 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
INFO - Stopping site azapp-rio-analyse-k6xbl__6cdd because it failed during startup.
最佳答案
当我忘记更新我的 requests.txt 文件以使用 Django>=3.1.0,<3.2.0,而不是 Django 3.0.8 时,我的 docker 应用程序遇到了这个问题。更新后我还必须运行 docker-compose build。
关于azure - 属性错误: module 'django.db.models' has no attribute 'JSONField' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63640881/
我对 mongoosejs 中模型的使用感到有些困惑。 可以通过这些方式使用 mongoose 创建模型 使用 Mongoose var mongoose = require('mongoose');
我正在看 from django.db import models class Publisher(models.Model): name = models.CharField(max_len
我有自己的 html 帮助器扩展,我用这种方式 model.Reason_ID, Register.PurchaseReason) %> 这样声明的。 public static MvcHtmlS
假设模型原本是存储在CPU上的,然后我想把它移到GPU0上,那么我可以这样做: device = torch.device('cuda:0') model = model.to(device) # o
我过去读过一些关于模型的 MVC 建议,指出不应为域和 View 重用相同的模型对象;但我找不到任何人愿意讨论为什么这很糟糕。 我认为创建两个单独的模型 - 一个用于域,一个用于 View - 然后在
我正在使用pytorch构建一个像VGG16这样的简单模型,并且我已经重载了函数forward在我的模型中。 我发现每个人都倾向于使用 model(input)得到输出而不是 model.forwar
tf.keras API 中的 models 是否多余?对于某些情况,即使不使用 models,代码也能正常运行。 keras.models.sequential 和 keras.sequential
当我尝试使用 docker 镜像运行 docker 容器时遇到问题:tensorflow/serving。 我运行命令: docker run --name=tf_serving -it tensor
我有一个模型,我用管道注册了它: register_step = PythonScriptStep(name = "Register Model",
如果 View 需要访问模型中的数据,您是否认为 Controller 应: a)将模型传递给 View b)将模型的数据传递给 View c)都不;这不应该是 Controller 所关心的。让 V
我正在寻找一个可以在模型中定义的字段,该字段本质上是一个列表,因为它将用于存储多个字符串值。显然CharField不能使用。 最佳答案 您正在描述一种多对一的关系。这应该通过一个额外的 Model 进
我最近了解了 Django 中的模型继承。我使用很棒的包 django-model-utils 取得了巨大的成功。我继承自 TimeStampedModel 和 SoftDeletableModel。
我正在使用基于 resnet50 的双输出模型进行项目。一个输出用于回归任务,第二个输出用于分类任务。 我的主要问题是关于模型评估。在训练期间,我在验证集的两个输出上都取得了不错的结果: - 综合损失
我是keras的新手。现在,我将使用我使用 model.fit_generator 训练的模型来预测测试图像组。我可以使用 model.predict 吗?不确定如何使用model.predict_g
在 MVC 应用程序中,我加入了多个表并将其从 Controller 返回到 View,如下所示: | EmployeeID | ControlID | DoorAddress | DoorID |
我在使用 sails-cassandra 连接系统的 Sails 中有一个 Data 模型。数据。 Data.count({...}).exec() 返回 1,但 Data.find({...}).e
我正在使用 PrimeFaces dataTable 开发一个 jsf 页面来显示用户列表。用户存储在 Model.User 类的对象中。
我正在关注https://www.tensorflow.org/tutorials/keras/basic_classification解决 Kaggle 挑战。 但是,我不明白应该将什么样的数据输入
我是这个领域的新手。那么,你们能帮忙如何为 CNN 创建 .config 文件吗? 传递有关如何执行此操作的文档或教程将对我有很大帮助。谢谢大家。 最佳答案 这个问题对我来说没有多大意义,因为 .co
我是“物理系统建模”主题的新手。我阅读了一些基础文献,并在 Modelica 和 Simulink/Simscape 中做了一些教程。我想问你,如果我对以下内容理解正确: 符号操作是将微分代数方程组(
我是一名优秀的程序员,十分优秀!