如何使用Pycharm社区免费版创建Django项目

对于python开发者来说,pycharm无疑是一款非常好用的开发ide,她有两个版本,一个社区版(免费),一个个人版(收费)。

免费版如果使用Django创建web项目那么就会提示需要升级到收费版本,那么如何使用免费版创建Django项目呢?

创建空项目

下载安装好pycharm个人版后,创建普通的python项目
file->new project->create

3. 引入Django

打开项目后,settings->Project:xxx->Python interpreter ->点击+号->输入Django->搜到后点击install

4. 控制台使用命令行创建项目

pycharm控制台打开:Terminal
进入刚创建的项目的根目录,
不过通过pycharm打开terminal默认在项目的根目录,
输入django-admin startproject MyWeb .
进入MyWeb目录 cd MyWeb
输入python manage.py runserver,
此时会有错误提示:You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

按照提示输入python manage.py migrate
等待片刻,发现MyWeb目录下多了若干文件,此时就创建完成了

5. 测试

启动服务进行测试,是否环境配置好:
控制台继续输入: python manage.py runserver
控制台没有报错,并有提示信息:
System check identified no issues (0 silenced).
January 19, 2024 - 05:15:54
Django version 4.2.9, using settings 'MyWeb.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

点击链接,打开了一个显示Django的网页界面,说明配置成功,可以愉快的进行后续开发了

(.venv) (base) gaoyuan.l@bagedeMacBook-Pro WebProject % django-admin startproject MyWeb .
(.venv) (base) gaoyuan.l@bagedeMacBook-Pro WebProject % cd MyWeb 
(.venv) (base) gaoyuan.l@bagedeMacBook-Pro MyWeb % python manage.py runserver 
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
January 19, 2024 - 05:14:53
Django version 4.2.9, using settings 'MyWeb.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

^C%                                                                                                                                                               (.venv) (base) gaoyuan.l@bagedeMacBook-Pro MyWeb % python manage.py migrate 
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying sessions.0001_initial... OK
(.venv) (base) gaoyuan.l@bagedeMacBook-Pro MyWeb % python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
January 19, 2024 - 05:15:54
Django version 4.2.9, using settings 'MyWeb.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

[19/Jan/2024 05:16:00] "GET / HTTP/1.1" 200 10664
Not Found: /favicon.ico
[19/Jan/2024 05:16:01] "GET /favicon.ico HTTP/1.1" 404 2109
^C%                                                                                                                                                               (.venv) (base) gaoyuan.l@bagedeMacBook-Pro MyWeb % 

相关推荐

  1. 如何使用Pycharm社区免费创建Django项目

    2024-01-23 06:34:02       52 阅读
  2. 第一个Flask项目(pycharm社区)

    2024-01-23 06:34:02       55 阅读
  3. 使用PyCharm创建Python项目

    2024-01-23 06:34:02       62 阅读
  4. Pycharm直接从github上下载项目社区

    2024-01-23 06:34:02       58 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-23 06:34:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-23 06:34:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-23 06:34:02       82 阅读
  4. Python语言-面向对象

    2024-01-23 06:34:02       91 阅读

热门阅读

  1. npm install vue3-print-nb --legacy-peer-deps npm ERR!

    2024-01-23 06:34:02       49 阅读
  2. bash 5.2中文修订2

    2024-01-23 06:34:02       51 阅读
  3. kafka(二)——常用命令

    2024-01-23 06:34:02       60 阅读
  4. npm源更换、卡住解决方式

    2024-01-23 06:34:02       46 阅读
  5. django mysql in 有序返回

    2024-01-23 06:34:02       63 阅读
  6. Spring - Security 之 Servlet身份验证架构

    2024-01-23 06:34:02       49 阅读
  7. DQL基础查询

    2024-01-23 06:34:02       53 阅读
  8. webIDE表单标签以及包含选择器的使用

    2024-01-23 06:34:02       55 阅读