Django 官方教程翻译项目工具的更多信息。 现在让我们进入交互式 Python 命令行,尝试一下 Django 为你创建的各种 API。通过以下命令 打开 Python 命令行: 1. $ python manage.py shell 我们使用这个命令而不是简单的使用 “Python” 是因为 manage.py 会设置 DJANGO_SETTINGS_MODULE 环境变量,这个变量会让 Django 根据 mysite/settings 中和时区相关的 django.utils.timezone 工具模 块。如果你不太熟悉 Python 中的时区处理,可以看看 时区支持文档。 保存文件然后通过 python manage.py shell 命令再次打开 Python 交互式命令行: 1. >>> from polls.models import Question, Choice 2. 3. # 确认添加的 __str__() 方法的返回值是否满 足预期?),而另一些测试可能检查对某个软件的一系列操作(某一用户输入序列是否造成了预期的 结果?)。其实这和我们在教程的 第二部分(zh)里做的并没有什么不同,我们使用 shell 来测试 某一方法的功能,或者运行某个应用并输入数据来检查它的行为。 真正不同的地方在于,自动化测试是由某个系统帮你自动完成的。当你创建好了一系列测试,每次修 改应用代码后,就可以自动检查出0 码力 | 103 页 | 1.86 MB | 1 年前3
Django 2.2.x Documentationoperating system’s package manager. You can verify that Python is installed by typing python from your shell; you should see something like: Python 3.x.y [GCC 4.x] on linux Type "help", "copyright", "credits" official release. Verifying To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django: >>> import django >>> print(django.get_version()) already. You can tell Django is installed and which version by running the following command in a shell prompt (indicated by the $ prefix): $ python -m django --version If Django is installed, you should0 码力 | 2915 页 | 2.83 MB | 1 年前3
Django 2.1.x Documentationoperating system’s package man- ager. You can verify that Python is installed by typing python from your shell; you should see something like: 12 Chapter 2. Getting started Django Documentation, Release 2.1 official release. 2.2.4 Verifying To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django: >>> import django >>> print(django.get_version()) already. You can tell Django is installed and which version by running the following command in a shell prompt (indicated by the $ prefix): $ python -m django --version If Django is installed, you should0 码力 | 1910 页 | 6.49 MB | 1 年前3
Django 2.1.x Documentationoperating system’s package manager. You can verify that Python is installed by typing python from your shell; you should see something like: Python 3.x.y [GCC 4.x] on linux Type "help", "copyright", "credits" official release. Verifying To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django: >>> import django >>> print(django.get_version()) already. You can tell Django is installed and which version by running the following command in a shell prompt (indicated by the $ prefix): $ python -m django --version If Django is installed, you should0 码力 | 2790 页 | 2.71 MB | 1 年前3
Django Q Documentation
Release 0.7.9Successful tasks Failed tasks Scheduled tasks Queued tasks Examples Emails Signals Reports Haystack Shell Groups Index Search Page © Copyright 2015, Ilan Steemers. Created using Sphinx 1.3.1. index modules schedule('tasks.clear_sessions_command', schedule_type='H') Check out the Shell examples if you want to schedule regular shell commands Reference schedule(func, *args, name=None, hook=None, schedule_type='O' adding a post_delete signal and calling index.remove_object in the async function. Shell You can execute or schedule shell commands using Pythons subprocess [https://docs.python.org/3.5/library/subprocess0 码力 | 62 页 | 514.67 KB | 1 年前3
Django 1.11.x DocumentationDjango on Jython for details. You can verify that Python is installed by typing python from your shell; you should see something like: Python 3.4.x [GCC 4.x] on linux Type "help", "copyright", "credits" official release. 2.2.5 Verifying To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django: >>> import django >>> print(django.get_version()) already. You can tell Django is installed and which version by running the following command in a shell prompt (indicated by the $ prefix): $ python -m django --version If Django is installed, you should0 码力 | 1878 页 | 6.40 MB | 1 年前3
Django 1.11.x DocumentationDjango on Jython for details. You can verify that Python is installed by typing python from your shell; you should see something like: Python 3.4.x [GCC 4.x] on linux Type "help", "copyright", "credits" official release. Verifying To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django: >>> import django >>> print(django.get_version()) already. You can tell Django is installed and which version by running the following command in a shell prompt (indicated by the $ prefix): $ python -m django --version If Django is installed, you should0 码力 | 2747 页 | 2.67 MB | 1 年前3
Django 2.0.x Documentationoperating system’s package man- ager. You can verify that Python is installed by typing python from your shell; you should see something like: Python 3.4.x [GCC 4.x] on linux Type "help", "copyright", "credits" official release. 2.2.5 Verifying To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django: >>> import django >>> print(django.get_version()) already. You can tell Django is installed and which version by running the following command in a shell prompt (indicated by the $ prefix): 2.3. Writing your first Django app, part 1 13 Django Documentation0 码力 | 1880 页 | 6.41 MB | 1 年前3
Django 2.0.x Documentationoperating system’s package manager. You can verify that Python is installed by typing python from your shell; you should see something like: Python 3.4.x [GCC 4.x] on linux Type "help", "copyright", "credits" official release. Verifying To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django: >>> import django >>> print(django.get_version()) already. You can tell Django is installed and which version by running the following command in a shell prompt (indicated by the $ prefix): $ python -m django --version If Django is installed, you should0 码力 | 2746 页 | 2.67 MB | 1 年前3
Django 4.0.x Documentationoperating system’s package man- ager. You can verify that Python is installed by typing python from your shell; you should see something like: Python 3.x.y [GCC 4.x] on linux Type "help", "copyright", "credits" dev20230214085346 2.2.4 Verifying To verify that Django can be seen by Python, type python from your shell. Then at the Python prompt, try to import Django: >>> import django >>> print(django.get_version()) already. You can tell Django is installed and which version by running the following command in a shell prompt (indicated by the $ prefix): $ python -m django --version If Django is installed, you should0 码力 | 2248 页 | 7.90 MB | 1 年前3
共 83 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9













