Django 官方教程翻译项目之类的冗余的后缀放到 URL 里。 为了设计你自己的 URL,你需要创建一个叫做 URLconf 的 Python 模块。一张包含 URL 匹配模 式和 Python 回调函数之间的映射表。URLconf 也有利于将 Python 代码与 URL 解耦合(译 注:使各个模块分离,独立)。 下面这个 URLconf 适用于前面 Reporter/Article 的例子: 1. # mysite/news/urls 注意 你得避免使用 Python 或 Django 的内部保留字来命名你的项目。具体地说,你得避免使用像 django(会和 Django 自己冲 突) 或 test(会和 Python 的内置模块冲突) 这样的名字。 我的代码该放在哪? 如果你曾经是老式 PHP 程序员(没有使用过现代框架),你可能会习惯地把代码放在 Web 服务器的文档根目录(比如 /var/www)。但使用 Django 以被很多个项目使用。 你的应用可以放在 Python path 中的任何目录里。在本教程中,我们将直接在 manage.py 所在 的目录里创建投票应用,这样它就能作为顶级模块被引入,而不是作为 mysite 的子模块。 请确定你现在处于 manage.py 所在的目录下,然后运行这行命令来创建一个应用: 1. $ python manage.py startapp polls 这将会创建一个0 码力 | 103 页 | 1.86 MB | 1 年前3
Django、Vue 和Element UI 前后端原理论述后端服务配置启动:在虚拟环境下,通过 Django 的 manage.py 启动服务,例如:python manage.py runserver。 后端创建子应用:根据项目的需要,可以创建多个子应用(app)来管理不同的功能 模块。 后端 Rest Framework:使用 Django Rest Framework 来构建 RESTful API,方便前端 和其他应用调用后端接口。 数据库配置:配置 Django 项目的数据库连接,通常使用 依赖、 构建工具和其他相关资源。以下是 npm 在前端开发中的应用介绍: 依赖管理:npm 可以管理前端项目的依赖,开发者可以在项目的 package.json 文件中 声明项目所依赖的第三方模块和库,以及其版本信息。在安装项目时,运行 npm install 命令会自动从 npm 仓库下载并安装这些依赖,使得项目能够在开发和生产环境中正常运 行。 脚本执行:在 package.json 些构建工具可以帮助开发者将前端代码进行打包、压缩、优化和处理,以提高前端项目 的性能和可维护性。 版本控制:npm 支持语义化版本控制(Semantic Versioning),开发者可以在 package.json 文件中声明模块的版本范围,以确保在安装依赖时不会引入不兼容的版本。 四、开发环境 Pycharm 使用非社区版本,我用的最新版本 (release 版) 在安装过程中,有的安装包在太老的版本中安装不成功。0 码力 | 61 页 | 6.84 MB | 1 年前3
Django Q Documentation
Release 1.3.6cluster was down, is to play catch up and execute all the missed time slots until things are back on schedule. You can override this behavior by setting catch_up to False. This will make those schedules run 1.8.1 Schedule Schedules are regular Django models. You can manage them through the Admin pages or directly from your code with the schedule() function or the Schedule model: # Use the schedule wrapper django_q.tasks import schedule schedule('math.copysign', 2, -2, hook='hooks.print_result', schedule_type='D') # Or create the object directly from django_q.models import Schedule Schedule.objects.create(func='math0 码力 | 62 页 | 452.10 KB | 1 年前3
Django Q Documentation
Release 1.3.6cluster was down, is to play catch up and execute all the missed time slots until things are back on schedule. You can override this behavior by setting catch_up to False. This will make those schedules run 1.8.1 Schedule Schedules are regular Django models. You can manage them through the Admin pages or directly from your code with the schedule() function or the Schedule model: # Use the schedule wrapper wrapper from django_q.tasks import schedule schedule('math.copysign', 2, -2, hook='hooks.print_result', schedule_type='D') # Or create the object directly (continues on next page) 32 Chapter 1. Features0 码力 | 64 页 | 453.51 KB | 1 年前3
Django Q Documentation
Release 1.3.6Connection pooling Reference Groups Reference Iterable Reference Chains Reference Schedules Schedule Missed schedules Management Commands Reference Cluster Multiple Clusters Using a Procfile Process cluster was down, is to play catch up and execute all the missed time slots until things are back on schedule. You can override this behavior by setting catch_up to False. This will make those schedules run Schedules Schedule Schedules are regular Django models. You can manage them through the Admin pages or directly from your code with the schedule() function or the Schedule model: # Use the schedule wrapper0 码力 | 81 页 | 512.48 KB | 1 年前3
Django Q Documentation
Release 1.3.6Connection pooling Reference Groups Reference Iterable Reference Chains Reference Schedules Schedule Missed schedules Management Commands Reference Cluster Multiple Clusters Using a Procfile Process cluster was down, is to play catch up and execute all the missed time slots until things are back on schedule. You can override this behavior by setting catch_up to False. This will make those schedules run Schedules Schedule Schedules are regular Django models. You can manage them through the Admin pages or directly from your code with the schedule() function or the Schedule model: # Use the schedule wrapper0 码力 | 81 页 | 512.34 KB | 1 年前3
Django Q Documentation
Release 0.7.9Async Iterable Groups Cached operations Synchronous testing Connection pooling Reference Schedules Schedule Missed schedules Management Commands Reference Cluster Multiple Clusters Using a Procfile Process cluster was down, is to play catch up and execute all the missed time slots until things are back on schedule. You can override this behavior by setting catch_up to False. This will make those schedules run Schedules Schedule Schedules are regular Django models. You can manage them through the Admin pages or directly from your code with the schedule() function or the Schedule model: # Use the schedule wrapper0 码力 | 62 页 | 514.67 KB | 1 年前3
Django Q Documentation
Release 0.7.9cluster was down, is to play catch up and execute all the missed time slots until things are back on schedule. You can override this behavior by setting catch_up to False. This will make those schedules run 1.5.1 Schedule Schedules are regular Django models. You can manage them through the Admin pages or directly from your code with the schedule() function or the Schedule model: # Use the schedule wrapper tasks import schedule schedule('math.copysign', 2, -2, hook='hooks.print_result', schedule_type=Schedule.DAILY) # Or create the object directly from django_q.models import Schedule Schedule.objects.create(func='math0 码力 | 50 页 | 397.77 KB | 1 年前3
Django Q Documentation
Release 0.5.3cpu_affinity Tasks Async Groups Synchronous testing Connection pooling Reference Schedules Schedule Missed schedules Management Commands Reference Cluster Multiple Clusters Using a Procfile Process cluster was down, is to play catch up and execute all the missed time slots until things are back on schedule. You can override this behavior by setting catch_up to False. This will make those schedules run documentation » Schedules Schedule Schedules are regular Django models. You can manage them through the Admin pages or directly from your code with the schedule() function or the Schedule model: from django_q0 码力 | 46 页 | 474.97 KB | 1 年前3
Django Q Documentation
Release 0.7.10Iterable Groups Chains Cached operations Synchronous testing Connection pooling Reference Schedules Schedule Missed schedules Management Commands Reference Cluster Multiple Clusters Using a Procfile Process cluster was down, is to play catch up and execute all the missed time slots until things are back on schedule. You can override this behavior by setting catch_up to False. This will make those schedules run Schedules Schedule Schedules are regular Django models. You can manage them through the Admin pages or directly from your code with the schedule() function or the Schedule model: # Use the schedule wrapper0 码力 | 67 页 | 518.39 KB | 1 年前3
共 84 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9













