当前位置:网站首页>【Django-Docker】Sqlite3.db读取权限不够-20220803
【Django-Docker】Sqlite3.db读取权限不够-20220803
2022-08-03 17:50:00 【i see the future】
问题:Sqlite3.db读取权限不够。
OperationalError at /user_login/ attempt to write a readonly database
参考链接:
https://blog.csdn.net/u013920085/article/details/51045709
解决办法:
1.通过django项目的settings.py可以看到关联数据库文件名称
…
DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.sqlite3’,
‘NAME’: os.path.join(BASE_DIR, ‘db.sqlite3’),
}
}
…
2.将django项目中的数据库文件(db.sqlite3)和数据库文件所在文件夹提升权限
chmod 777 db.sqlite3
cd …
chmod 777 *
3.再次访问数据库就没问题
修改dockfile如下
RUN chmod 777 /code/package/GAGA/SQL
RUN chmod 777 /code/package/GAGA/SQL/db.sqlite3
FROM python:3.8-slim
RUN apt-get update -y && apt-get install gcc -y
COPY ./Django /code
WORKDIR /code/package
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple uwsgi
EXPOSE 8000
RUN chmod 777 /code/package/runserver-docker.sh
RUN chmod 777 /code/package/start.sh
RUN chmod 777 /code/package/GAGA/SQL
RUN chmod 777 /code/package/GAGA/SQL/db.sqlite3
# Windows环境下编写的start.sh每行命令结尾有多余的\r字符,需移除。
RUN sed -i 's/\r//' ./start.sh
# 设置start.sh文件可执行权限
RUN chmod +x ./start.sh
# 设置start.sh文件可执行权限
RUN chmod 777 *
#CMD ["/bin/sh","/code/package/start.sh"]
边栏推荐
- Web3 security risks daunting?How should we respond?
- ICDAR competition technology sharing
- yaml data format
- MVCC多版本并发控制的理解
- ICDAR比赛技术分享
- 【技术白皮书】第二章:OCR智能文字识别回顾——自然语言文本发展历程
- 2020icpc亚洲区域赛(济南)M题Cook Pancakes(小根堆的应用)
- Digital IC Handwriting - MCMM, WNS and TNS
- Is OnePlus Ace worth buying?Use strength to interpret the power of performance
- NLP范式新变化:Prompt
猜你喜欢
随机推荐
select......for update 语句的功能是什么? 会锁表还是锁行?
CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) A-E
Web3 security risks daunting?How should we respond?
如何成为优秀的产品运营?
How to install and start VNC remote desktop service on cloud GPU?
这是Facebook母公司 关于元宇宙的80万亿美元豪赌
2020icpc亚洲区域赛(济南)M题Cook Pancakes(小根堆的应用)
ASP.NET Core依赖注入之旅:3.Service Locator和依赖注入
PMP考试通关宝典-敏捷专题
rhel8.3 系统下修改有线网卡配置信息实现联网
leetcode-每日一题899. 有序队列(思维题)
链表中倒数第k个结点
websocket Handshake failed due to invalid Upgrade header
Interpretation of the paper (JKnet) "Representation Learning on Graphs with Jumping Knowledge Networks"
mysql命令
多商户商城系统功能拆解21讲-平台端分销订单
七夕
Gson 学习笔记
401. Binary Watch
【牛客在线OJ】-字符逆序









