当前位置: 首页 > news >正文

在PyCharm的Django工程中修改初始页

1、原始的初始页

2、setting.py中添加应用

在quiz_site的setting.py 进行应用到的设置(对应的是一个根目录下的文件夹)

3、Quiz_site\urls.py中的设置

4、修改quiz/urls.py

修改后的内容如下:

5、views.py的设置

如图:

6、建立主页

在quiz目录下建立2级目录,并建立对应的home.html,路径和views.py中对应,如图:

Home.html中的内容如下:

!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{{ title }}</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; background-color: #f5f7fa; color: #333; line-height: 1.6; } .navbar { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.1); } .navbar-brand { font-size: 24px; font-weight: bold; text-decoration: none; color: white; } .nav-links { display: flex; gap: 20px; align-items: center; } .nav-links a { color: white; text-decoration: none; padding: 8px 16px; border-radius: 4px; transition: background 0.3s; } .nav-links a:hover { background: rgba(255, 255, 255, 0.1); } .btn-register { background: white; color: #667eea !important; font-weight: bold; } .hero { text-align: center; padding: 80px 20px; background: white; margin: 30px auto; max-width: 1000px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); } .hero h1 { font-size: 48px; margin-bottom: 20px; color: #333; } .hero p { font-size: 20px; color: #666; margin-bottom: 30px; max-width: 700px; margin-left: auto; margin-right: auto; } .cta-buttons { display: flex; gap: 20px; justify-content: center; margin-top: 40px; } .btn { padding: 15px 30px; font-size: 18px; border-radius: 8px; text-decoration: none; font-weight: bold; transition: all 0.3s; display: inline-block; } .btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; } .btn-primary:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3); } .btn-secondary { background: white; color: #667eea; border: 2px solid #667eea; } .btn-secondary:hover { background: #f8f9fa; transform: translateY(-3px); } .features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; max-width: 1000px; margin: 60px auto; padding: 0 20px; } .feature-card { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); text-align: center; } .feature-icon { font-size: 48px; margin-bottom: 20px; color: #667eea; } .feature-card h3 { margin-bottom: 15px; color: #333; } footer { text-align: center; padding: 30px; margin-top: 60px; background: #2c3e50; color: white; } .user-info { display: flex; align-items: center; gap: 15px; } .user-welcome { color: white; } </style> </head> <body> <!-- 导航栏 --> <nav class="navbar"> <a href="/" class="navbar-brand">📚 Quiz 学习平台</a> <!-- 用户登录状态 --> </nav> <!-- 主要内容区域 --> <main> <section class="hero"> <h1>欢迎来到 Quiz 学习平台</h1> <p>{{ welcome_message }}</p> <p>这是一个专业的在线学习平台,提供丰富的题库和智能学习分析。</p> </section> <!-- 功能特色 --> <section class="features"> <div class="feature-card"> <div class="feature-icon">📖</div> <h3>丰富题库</h3> <p>涵盖多种学科,上万道精选题目,满足不同学习需求。</p> </div> <div class="feature-card"> <div class="feature-icon">📈</div> <h3>智能分析</h3> <p>详细的学习报告和进度分析,帮助您针对性提升。</p> </div> <div class="feature-card"> <div class="feature-icon">🎯</div> <h3>个性化学习</h3> <p>根据学习进度和能力,推荐最适合的学习内容。</p> </div> </section> </main> <!-- 页脚 --> <footer> <p>© 2024 Quiz 学习平台. 保留所有权利.</p> <p>Django 5.2 | Python 3.11</p> </footer> </body> </html>

Home.html的代码是DeepSeek帮我生成的。

7、打开网站

运行manage

对应的参数设置:

点击链接,如下图:

得到新的主页,如下图:

http://www.cnnetsun.cn/news/2024287.html

相关文章:

  • 使用FCM进行编码解码
  • Aligning Agents via Planning: A Benchmark for Trajectory-Level Reward
  • Java 25虚拟线程上线倒计时(某千万级金融网关72小时迁移实录:QPS翻倍、GC停顿下降92%)
  • 医疗AI部署生死线(Docker 27合规配置黄金7步法)
  • ACPI _DSM方法全解析:从UUID到Function Index的实战指南
  • realme数据恢复:综合指南5大解决方案
  • 【.NET 11 AI加速黄金配置清单】:Visual Studio 17.10 + ML.NET 4.0.1 + Windows 11 23H2 WSL2 GPU直通——实测推理速度对比表曝光
  • WordPress内核源码深度技术分析报告
  • Steam创意工坊下载实践指南:WorkshopDL深度解析
  • diff-pdf:专业PDF视觉差异检测的5大核心优势与实施指南
  • 生产IC白卡厂家推荐
  • 实在 Agent 企业级智能体深度评测:从参数解析到全场景落地验证
  • 中小企业买不起Datadog,有什么平替?——2026可观测性平台选型与智能体运维实战指南
  • UEFI HII开发避坑指南:VFR文件编译成IFR后,那些‘消失’的代码和自动生成的OpCode
  • Real Anime Z参数详解:为何禁用高步数?Turbo模型收敛机制解析
  • 从Matlab天线工具箱到实际仿真:用软件验证弗里斯公式常数-32.44dB的正确性
  • M62429电子音量芯片驱动避坑指南:从数据手册到稳定波形,这些细节你注意了吗?
  • RPC项目
  • 如何增加RAC节点_addnode.sh脚本执行与实例扩展全流程
  • 不只是pip install:深入理解sentence_transformers在PyG MovieLens中的角色与替代方案
  • PTA C语言实验代码复盘:从学生作业到面试常考算法题的提炼
  • 为什么丰田、谷歌都在布局 Multi-Agent:制造业与科技巨头的战略解读
  • 告别模拟信号:手把手教你用示波器解析汽车传感器的SENT协议数据帧
  • 玻璃幕墙使用、检查、维护知识
  • 【仅限首批内测用户公开】Docker 27隐藏AI调度开关——启用后TensorFlow容器启动速度提升62%
  • 高新技术企业(高企)管理成熟度自诊系统设计与实现
  • 用ESP32-S2做个蓝牙音箱?从ADF环境配置到播放MP3的全流程实录
  • STM32+FreeModbus实战:用AHT20传感器搭建低成本温湿度监测从机(附完整代码)
  • Hotkey Detective:3步快速解决Windows热键冲突的终极工具
  • [盖茨同步带]盖茨 Poly Chain® Carbon™ Volt® 同步带|Carbon Volt 8GTV