Django 似乎没有找到我的主机0.0.0.0
我已经将“0.0.0.0”添加到我的 ALLOWED_HOSTS 中。事实上,如果我print(ALLOWED_HOSTS)得到了
['localhost', '127.0.0.1', '0.0.0.0', '[::1]']。我在码头工人工作。有什么我忽略的吗?
.env.dev
DEBUG=1
SECRET_KEY=foo
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 0.0.0.0 [::1]
SQL_ENGINE=django.db.backends.postgresql
SQL_DATABASE=xxxx
SQL_USER=xxxx
SQL_PASSWORD=xxxx
SQL_HOST=db
SQL_PORT=5432
DATABASE=postgres
Run Code Online (Sandbox Code Playgroud)
env_settings.py
import os
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
# DEBUG = True
DEBUG = int(os.environ.get("DEBUG", default=0))
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ")
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) …Run Code Online (Sandbox Code Playgroud) 我正在使用 GitLab 为我的 django 项目构建 CI/CD。作为部署阶段的一部分,我有
deploy:
stage: deploy
script:
- mkdir -p ~/.ssh
- echo "$PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- cat ~/.ssh/id_rsa
- chmod 700 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
- chmod +x ./deploy.sh
- scp -o StrictHostKeyChecking=no -r ./.env ./docker-compose.prod.yml ec2-user@$EC2_PUBLIC_IP_ADDRESS:/home/ec2-user/app
- bash ./deploy.sh
only:
- master
Run Code Online (Sandbox Code Playgroud)
构建失败,ssh-add ~/.ssh/id_rsa并显示错误消息Error loading key "/root/.ssh/id_rsa": invalid format。
我检查过有类似错误消息问题的人,但似乎没有一个与我正在做的事情相关。
我有一个包含3列的数据框candle,point并且time。如果蜡烛candle到达该点,请b创建一个新列,其中包含蜡烛到达该点的时间
我尝试这样做
df = pd.DataFrame({'candle':[23,22,25,23,22,23,25,25,22],'point':['a','a','a','b','b','c','b','c','a'],'time':['2019-07-05 12:22:22','2019-07-10 12:22:22','2019-07-15 12:22:22','2019-07-20 12:22:22','2019-07-25 12:22:22','2019-07-30 12:22:22','2019-07-35 12:22:22','2019-07-40 12:22:22','2019-07-45 12:22:22']})
df
Out[5]:
candle point time
0 23 a 2019-07-05 12:22:22
1 22 a 2019-07-10 12:22:22
2 25 a 2019-07-15 12:22:22
3 23 b 2019-07-20 12:22:22
4 22 b 2019-07-25 12:22:22
5 23 c 2019-07-30 12:22:22
6 25 b 2019-07-35 12:22:22
7 25 c 2019-07-40 12:22:22
8 22 a 2019-07-45 12:22:22
def arrival_dates(df,end):
candle_at_target = df[df["point"] == …Run Code Online (Sandbox Code Playgroud)