本文介绍了Django:尝试编写只读数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚使用
python manage.py startapp smartrecruitment
然后我运行了数据库同步
I then ran a db sync
python manage.py syncdb
Operations to perform:
Apply all migrations: admin, contenttypes, auth, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying sessions.0001_initial... OK
并添加了我的超级用户,但是我无法在浏览器中访问/admin.我尝试执行以下命令来授予apache权限,但是没有运气.
And added my superuser, but I cannot access /admin in the browser. I have tried doing the following commands to give apache permissions, but have had no luck.
sudo chown apache <folder_containing_db.sqlite3>
sudo chown apache db.sqlite3
推荐答案
更改项目目录和数据库文件 www-data
change owner of the project directory and database file www-data
chown www-data:www-data /home/username/Django
chown www-data:www-data /home/username/Django/db.sqlite
这篇关于Django:尝试编写只读数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!