参考Django书,第3章:
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.foo.urls')),
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# url(r'^admin/', include(admin.site.urls)),
)
Run Code Online (Sandbox Code Playgroud)
是什么决定了为什么一个东西被包含为字符串,另一个被包含为常规变量?为什么admin.site.urls但不是'admin.site.urls'?所有其他include的都包含在字符串中...我在这里看不到逻辑模式.
我正在Windows上的Python 3.7.1中尝试执行以下操作
import sqlite3
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误消息
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "c:\programdata\anaconda3\lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "c:\programdata\anaconda3\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.
Run Code Online (Sandbox Code Playgroud)
我搜索该问题的解决方案已经有一段时间了,但无济于事。我也已经pip install pysqlite3在Anaconda提示符下成功运行,但是导入仍然失败。做什么?
我有一个简单的静态网站,我尝试使用 GitHub Actions 将其部署为 Azure 静态 Web 应用程序(无框架)。我的目录结构是:
\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 .github/workflows/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 css/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 img/\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 js/\n\xe2\x94\x9c index.html\nRun Code Online (Sandbox Code Playgroud)\n当我推送到 GitHub 存储库时,Azure 静态 Web 应用 CI/CD 操作将启动生成和部署作业。在 .github/workflows 目录中的 YAML 配置文件中,我为存储库/构建配置设置了以下内容:
\napp_location: "/" # The app source code is in the root directory for the repo\napi_location: "" # There is no API that needs to be configured\noutput_location: "/" # my index.html file is in the root directory for the repo\nRun Code Online (Sandbox Code Playgroud)\n但是,我在构建和部署作业中收到以下错误:
\n\n\n无法在应用程序工件文件夹 (/) 中找到默认文件。有效\n默认文件:index.html、Index.html。如果您的应用程序包含\n纯静态内容,请验证工作流文件(位于 .github/workflows 中)中的变量“app_location”\n是否指向应用程序的根目录。
\n
当我指定了 …
我正在查看以下代码:
from random import choice
for val in range(10):
a = ','.join(str(choice(range(20))) for idx in range(4))
print a
Run Code Online (Sandbox Code Playgroud)
并意识到我没有使用seed()。如果您打算生成不同的伪随机序列,我被教导如何为随机数生成器播种。
我决定运行代码,期望每次都会重复该序列。但在多次运行代码后,似乎每次都会生成不同的序列。
我尝试重定向到代理服务器 nginx。
location /phpmyadmin {
proxy_http_version 1.1;
proxy_pass https://${PMA}:5000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
Run Code Online (Sandbox Code Playgroud)
但我收到错误:
nginx: [emerg] invalid number of arguments in "proxy_set_header" directive in /etc/nginx/nginx.conf:26
Run Code Online (Sandbox Code Playgroud)
此清单中检查错误的完整代码,因为我真的找不到某些错误(${env} = 脚本中的正确更改
user root;
worker_processes auto;
pcre_jit on;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
keepalive_timeout 3000;
sendfile on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/ssl/nginx.crt;
ssl_certificate_key /etc/ssl/nginx.key;
root /home;
index default.html /default.html;
location /phpmyadmin {
proxy_http_version 1.1;
proxy_pass https://${PMA}:5000/; …Run Code Online (Sandbox Code Playgroud) reverse-proxy nginx docker docker-compose nginx-reverse-proxy
python ×2
anaconda ×1
azure ×1
django ×1
docker ×1
importerror ×1
nginx ×1
python-3.x ×1
random ×1
random-seed ×1
sqlite ×1
url ×1
urlconf ×1
windows ×1