我有一个 django 项目。Settings.py:STATIC_URL = 'static/'STATIC_ROOT = 'static'MEDIA_URL = '/media/'MEDIA_ROOT = BASE_DIR / 'media'我已经执行了 collectstatic 并且一切正常。现在...
我有一个 django 项目。
设置.py:
STATIC_URL = 'static/'
STATIC_ROOT = 'static'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
我已经完成了 collectstatic
,一切运行正常。现在我服务器上的静态文件夹包含所有文件。
Nginx的:
我在使用 nginx 时遇到了问题,因为我改了一个名字, sites_available
然后开始出现错误,所以我重新安装了它,现在从日志来看一切都正常:
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset:>
Active: active (running) since Wed 2024-05-01 14:47:13 UTC; 11min ago
Docs: man:nginx(8)
Process: 6843 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_proce>
Process: 6844 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (c>
Main PID: 6845 (nginx)
Tasks: 2 (limit: 1026)
Memory: 3.1M
CPU: 60ms
CGroup: /system.slice/nginx.service
6845 "nginx: master process /usr/sbin/nginx -g daemon on; master>
6846 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "">
May 01 14:47:13 23210 systemd[1]: nginx.service: Deactivated successfully.
May 01 14:47:13 23210 systemd[1]: Stopped A high performance web server and a r>
May 01 14:47:13 23210 systemd[1]: Starting A high performance web server and a >
May 01 14:47:13 23210 systemd[1]: Started A high performance web server and a r>
~
~
~
~
~
~
ESCOC
server and a reverse proxy server
/nginx.service; enabled; vendor preset: enabled)
2024-05-01 14:47:13 UTC; 11min ago
/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
inx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
ss /usr/sbin/nginx -g daemon on; master_process on;"
ss" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
service: Deactivated successfully.
d A high performance web server and a reverse proxy server.
ng A high performance web server and a reverse proxy server...
d A high performance web server and a reverse proxy server.
~
~
~
~
~
~
ESCOD
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset:>
Active: active (running) since Wed 2024-05-01 14:47:13 UTC; 11min ago
Docs: man:nginx(8)
Process: 6843 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_proce>
Process: 6844 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (c>
Main PID: 6845 (nginx)
Tasks: 2 (limit: 1026)
Memory: 3.1M
CPU: 60ms
CGroup: /system.slice/nginx.service
6845 "nginx: master process /usr/sbin/nginx -g daemon on; master>
6846 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "">
May 01 14:47:13 23210 systemd[1]: nginx.service: Deactivated successfully.
May 01 14:47:13 23210 systemd[1]: Stopped A high performance web server and a r>
May 01 14:47:13 23210 systemd[1]: Starting A high performance web server and a >
May 01 14:47:13 23210 systemd[1]: Started A high performance web server and a r>
~
~
~
~
~
~
lines 1-18/18 (END)
[2]+ Stopped systemctl status nginx
^Z
但我不知道为什么会出现错误。
Nginx 配置:
server {
listen 80;
server_name 77.777.77.77;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/ubuntu/portfolio-server;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
我有以下接口,它定义了一个对象,其中属性可以是两种不同的类型。导出接口 OptionsA { name: string;}导出接口 OptionsB { parts: number...
我有以下接口,它定义一个对象,其中的属性可以是两种不同的类型。
export interface OptionsA {
name: string;
}
export interface OptionsB {
parts: number;
}
export interface OptionsConfig {
[key: string]: OptionsA | OptionsB;
}
这可以正常工作,但有一个限制,即类型的属性 OptionsB
必须以 "@"
.
例如;
const example: OptionsConfig = {
'@sample': {parts: 1},
other: {name: 'example'}
};
因此,上述代码可以正常运行,但下面的示例是不正确的。
const example: OptionsConfig = {
'@sample': {parts: 1},
other: {name: 'example'},
'@wrong': {name: 'error'}
};
我想知道是否可以使用 TypeScript 声明 @wrong
只能实现 OptionsB
接口,因为它有 @
前缀。
或者,是否有另一种方法可以实现类似的限制。