Comments (2)
设置一下 app 目录,在 setting.py
里有对应的代码:
sys.path.insert(0, os.path.join(BASE_DIR, 'apps'))
设置完之后,原本需要这么写的代码:
from app.users.views import IndexView
只需要这么写:
from users.views import IndexView
前面不需要加 apps
了
但是如果你用的是 pycharm ,它可能会报错,你需要右键 apps 这个目录,mark 成 Sources Root
from imooc-django.
3q
from imooc-django.
Related Issues (20)
- 之前登录过的话,无法退出,点击退出登录,页面刷新之后仍旧读取登录信息自动登录 HOT 16
- 大神进入xadmin没有样式 HOT 2
- 数据库编码问题 HOT 3
- 把Django项目部署到Nginx+Uwsgi上出现问题 HOT 1
- 请问这个比起php来说会不会要多一些机器 HOT 6
- 后台管理登录. HOT 1
- xadmin点击第二级菜单Django Crash. HOT 2
- 问下关于list_filter的问题 HOT 4
- 关于用户和用户组 HOT 5
- qq HOT 1
- 可乐的代码 HOT 1
- 小白龙
- 雷子的代码
- 阿古瓜的代码 HOT 1
- 我大PHP是世界上最好的语言
- ... HOT 1
- Demo Link Will Only Return 500 Page HOT 2
- 求助HTML原始代码? HOT 1
- 首页排版乱了
- 执行make migrate时候报错!!!! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imooc-django.