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 年前3Django、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 年前3Django 2.1.x Documentation
example, an English translation may be "Today is November 26.", while a Spanish translation may be "Hoy es 26 de Noviembre." – with the month and the day placeholders swapped. For this reason, you should use simple lists of language codes. If you do this in your view: context = {'available_languages': ['en', 'es', 'fr']} return render(request, 'mytemplate.html', context) you can iterate over those languages in directory containing the translation is expected to be named using locale name notation. E.g. de, pt_BR, es_AR, etc. Untranslated strings for territorial language variants use the translations of the generic0 码力 | 1910 页 | 6.49 MB | 1 年前3Django 2.1.x Documentation
the form ll or a combined language and country specification of the form ll_CC. Examples: it, de_AT, es, pt_BR. The language part is always in lower case and the country part in upper case. The separator the languages they accept in the Accept-Language HTTP header using this format. Examples: it, de-at, es, pt-br. Language codes are generally represented in lower-case, but the HTTP Accept-Language header example, an English translation may be "Today is November 26.", while a Spanish translation may be "Hoy es 26 de Noviembre." – with the month and the day placeholders swapped. For this reason, you should use0 码力 | 2790 页 | 2.71 MB | 1 年前3Django 2.2.x Documentation
the form ll or a combined language and country specification of the form ll_CC. Examples: it, de_AT, es, pt_BR. The language part is always in lowercase and the country part in upper case. The separator the languages they accept in the Accept-Language HTTP header using this format. Examples: it, de-at, es, pt-br. Language codes are generally represented in lowercase, but the HTTP Accept-Language header example, an English translation may be "Today is November 26.", while a Spanish translation may be "Hoy es 26 de Noviembre." – with the month and the day placeholders swapped. For this reason, you should use0 码力 | 2915 页 | 2.83 MB | 1 年前3Django 5.1 Documentation
the form ll or a combined language and country specification of the form ll_CC. Examples: it, de_AT, es, pt_BR, sr_Latn. The language part is always in lowercase. The country part is in titlecase if it has the languages they accept in the Accept-Language HTTP header using this format. Examples: it, de-at, es, pt-br. Language codes are generally represented in lowercase, but the HTTP Accept-Language header example, an English translation may be "Today is November 26.", while a Spanish translation may be "Hoy es 26 de noviembre." – with the month and the day placeholders swapped. For this reason, you should use0 码力 | 3513 页 | 3.17 MB | 1 年前3Django 5.1.2 Documentation
the form ll or a combined language and country specification of the form ll_CC. Examples: it, de_AT, es, pt_BR, sr_Latn. The language part is always in lowercase. The country part is in titlecase if it has the languages they accept in the Accept-Language HTTP header using this format. Examples: it, de-at, es, pt-br. Language codes are generally represented in lowercase, but the HTTP Accept-Language header example, an English translation may be "Today is November 26.", while a Spanish translation may be "Hoy es 26 de noviembre." – with the month and the day placeholders swapped. For this reason, you should use0 码力 | 3519 页 | 3.17 MB | 1 年前3Django 3.0.x Documentation
the form ll or a combined language and country specification of the form ll_CC. Examples: it, de_AT, es, pt_BR. The language part is always in lowercase and the country part in upper case. The separator the languages they accept in the Accept-Language HTTP header using this format. Examples: it, de-at, es, pt-br. Language codes are generally represented in lowercase, but the HTTP Accept-Language header example, an English translation may be "Today is November 26.", while a Spanish translation may be "Hoy es 26 de noviembre." – with the month and the day placeholders swapped. For this reason, you should use0 码力 | 3085 页 | 2.95 MB | 1 年前3Django 3.1.x Documentation
example, an English translation may be "Today is November 26.", while a Spanish translation may be "Hoy es 26 de noviembre." – with the month and the day placeholders swapped. For this reason, you should use supports lists of language codes. If you do this in your view: context = {'available_languages': ['en', 'es', 'fr']} return render(request, 'mytemplate.html', context) you can iterate over those languages in directory containing the translation is expected to be named using locale name notation. E.g. de, pt_BR, es_AR, etc. Untranslated strings for territorial language variants use the translations of the generic0 码力 | 2053 页 | 6.92 MB | 1 年前3Django 4.2.x Documentation
the form ll or a combined language and country specification of the form ll_CC. Examples: it, de_AT, es, pt_BR, sr_Latn. The language part is always in lowercase. The country part is in titlecase if it has the languages they accept in the Accept-Language HTTP header using this format. Examples: it, de-at, es, pt-br. Language codes are generally represented in lowercase, but the HTTP Accept-Language header example, an English translation may be "Today is November 26.", while a Spanish translation may be "Hoy es 26 de noviembre." – with the month and the day placeholders swapped. For this reason, you should use0 码力 | 3305 页 | 3.16 MB | 1 年前3
共 32 条
- 1
- 2
- 3
- 4