5.安装&卸载子应用 投票
2024-10-20 11:44:25
另起一个新的Django项目 djangoProject_poll_test
........
把.tar.gz包下载到某个路径
D:\此电脑下分类\桌面\django-polls\dist\django-polls-0.1.tar.gz
安装子应用
定位到压缩包位置 执行
(venv) D:\此电脑下分类\桌面\django-polls\dist>
(venv) D:\此电脑下分类\桌面\django-polls\dist>python -m pip install django-polls-0.1.tar.gz
Processing d:\此电脑下分类\桌面\django-polls\dist\django-polls-0.1.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: Django>=4.0 in e:\python\0code\studybuddy\venv\lib\site-packages (from django-polls==0.1) (4.0.5)
Requirement already satisfied: tzdata in e:\python\0code\studybuddy\venv\lib\site-packages (from Django>=4.0->django-polls==0.1) (2022.1)
Requirement already satisfied: sqlparse>=0.2.2 in e:\python\0code\studybuddy\venv\lib\site-packages (from Django>=4.0->django-polls==0.1) (0.4.2)
Requirement already satisfied: asgiref<4,>=3.4.1 in e:\python\0code\studybuddy\venv\lib\site-packages (from Django>=4.0->django-polls==0.1) (3.5.2)
DEPRECATION: Source distribution is being reinstalled despite an installed package having the same name and version as the installed package. pip 2
1.2 will remove support for this functionality. A possible replacement is use --force-reinstall. You can find discussion regarding this at https://
github.com/pypa/pip/issues/8711.
Building wheels for collected packages: django-polls
Building wheel for django-polls (PEP 517) ... done
Created wheel for django-polls: filename=django_polls-0.1-py3-none-any.whl size=529100 sha256=e1b1dc64f611731e5e9e9bd0ad1784571b86c43a9cc8912b1a7
5abda32eec09a
Stored in directory: c:\users\大飞斗\appdata\local\pip\cache\wheels\8d\95\18\87a91d3e9c9b7975ad9909d81d99733f5a863ee9e320a85e55
Successfully built django-polls
Installing collected packages: django-polls
Attempting uninstall: django-polls
Found existing installation: django-polls 0.1
Uninstalling django-polls-0.1:
Successfully uninstalled django-polls-0.1
Successfully installed django-polls-0.1
WARNING: You are using pip version 21.1.2; however, version 23.0 is available.
You should consider upgrading via the 'E:\PYTHON\0CODE\StudyBuddy\venv\Scripts\python.exe -m pip install --upgrade pip' command.
(venv) D:\此电脑下分类\桌面\django-polls\dist>
(venv) D:\此电脑下分类\桌面\django-polls\dist>
按照README.rst编辑配置文件
=====
Polls
=====
Polls is a Django app to conduct web-based polls. For each question,
visitors can choose between a fixed number of answers.
Detailed documentation is in the "docs" directory.
Quick start
-----------
1. Add "polls" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
...
'polls',
]
2. Include the polls URLconf in your project urls.py like this::
path('polls/', include('polls.urls')),
3. Run ``python manage.py migrate`` to create the polls models.
4. Start the development server and visit http://127.0.0.1:8000/admin/
to create a poll (you'll need the Admin app enabled).
5. Visit http://127.0.0.1:8000/polls/ to participate in the poll.
- urls.py
- settings.py
启动
可见数据还是空的
也无法用之前的用户登录
新建用户 newf 并登录
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>python manage.py createsuperuser
Username: newf
Email address: newf@qq.com
Password:
Password (again):
The password is too similar to the username.
This password is too short. It must contain at least 8 characters.
Bypass password validation and create user anyway? [y/N]: y
Superuser created successfully.
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>python manage.py runserver 5000
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
February 17, 2023 - 21:28:03
Django version 4.0.5, using settings 'djangoProject_poll_test.settings'
Starting development server at http://127.0.0.1:5000/
Quit the server with CTRL-BREAK.
[17/Feb/2023 21:28:05] "POST /admin/login/?next=/admin/ HTTP/1.1" 302 0
[17/Feb/2023 21:28:05] "GET /admin/ HTTP/1.1" 200 4394
[17/Feb/2023 21:28:06] "GET /static/admin/img/icon-changelink.svg HTTP/1.1" 200 380
[17/Feb/2023 21:28:06] "GET /static/admin/img/icon-addlink.svg HTTP/1.1" 200 331
效果
回忆之前
我们设置的后台风格修改的html文件
在这里
都没有生效,因为
他们都被隔离到主项目的templages里面了
卸载
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>python -m pip uninstall django-polls
Found existing installation: django-polls 0.1
Uninstalling django-polls-0.1:
Would remove:
e:\python\0code\studybuddy\venv\lib\site-packages\django_polls-0.1.dist-info\*
e:\python\0code\studybuddy\venv\lib\site-packages\polls\*
Proceed (y/n)? y
Successfully uninstalled django-polls-0.1
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>
(venv) E:\PYTHON\0CODE\djangoProject_poll_test>
最新文章
- python爬虫学习(10) —— 专利检索DEMO
- Bootstrap系列 -- 7. 列表排版方式
- AsyncTask下载网络图片
- ultraedit15.00.0.1046注册码
- 使用SSIS创建同步数据库数据任务
- 重建Mac系统的文件打开方式
- UITableViewCell和UITableViewHeaderFooterView的重用
- 如何计算Java对象占用了多少空间?
- sql点滴41—MyISAM 和 InnoDB 讲解
- 【css笔记(2)】如何给元素应用规则?
- 在eclipse上使用github,向github中提交项目
- 1025. PAT Ranking (25)
- javaWeb-Servlet工作原理
- D - GCD HDU - 1695 -模板-莫比乌斯容斥
- retrofit 基础使用
- Linux搜索查找类指令
- unix环境高级编程-3.10-文件共享(转)
- 【python笔记】使用matplotlib,pylab进行python绘图
- 【转】在 XAML 的属性中,转义大括号 {}
- [svc]tomcat目录结构/虚拟主机/nginx反向代理cache配置