deepin系统下django项目创建步骤

1.配置deepin系统下pip源目录Mkdir .pip
vim .pip/pip.conf
douser@douser-PC:~$ cat .pip/pip.conf [global] index-url = https://pypi.doubanio.com/simple/ timeout = 1000 use-mirrors = true mirrors = https://pypi.doubanio.com// douser@douser-PC:~$
2.打开pycharm 新建工程,进入虚拟terminal项输入pip3 install Django
douser@douser-PC:~$ pip3 install django WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly. Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.doubanio.com/simple/ Requirement already satisfied: django in ./.local/lib/python3.7/site-packages (3.1.3)Requirement already satisfied: pytz in ./.local/lib/python3.7/site-packages (from django) (2020.4) Requirement already satisfied: asgiref<4,>=3.2.10 in ./.local/lib/python3.7/site-packages (from django) (3.3.1) Requirement already satisfied: sqlparse>=0.2.2 in ./.local/lib/python3.7/site-packages (from django) (0.4.1) douser@douser-PC:~$
3.用pip管理工具查看安装django的版本信息及django包详细信息
douser@douser-PC:~/PycharmProjects/pyDjango$ pip3 list
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.Package       Version------------- --------asgiref       3.3.1asn1crypto    0.24.0cryptography  2.6.1distro        1.3.0Django        3.1.3entrypoints   0.3keyring       17.1.1keyrings.alt  3.1.1lxml          4.6.1onboard       1.4.1pexpect       4.6.0Pillow        5.4.1pip           20.2.4pycairo       1.16.2pycrypto      2.6.1PyGObject     3.30.4pysmbc        1.0.15.6pytz          2020.4pyxdg         0.25reportlab     3.5.13SecretStorage 2.3.1setuptools    40.8.0six           1.12.0sqlparse      0.4.1wheel         0.32.3
douser@douser-PC:~/PycharmProjects/pyDjango$ pip3 show Django
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.Name: DjangoVersion: 3.1.3Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.Home-page: https://www.djangoproject.com/Author: Django Software FoundationAuthor-email: foundation@djangoproject.comLicense: BSD-3-ClauseLocation: /home/douser/.local/lib/python3.7/site-packagesRequires: sqlparse, pytz, asgirefRequired-by: douser@douser-PC:~/PycharmProjects/pyDjango$
4.核实安装的django版本douser@douser-PC:~/PycharmProjects/pyDjango$ python3
Python 3.7.3 (default, Oct 28 2020, 14:33:53) [GCC 8.3.0] on linuxType "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
3.1.3
>>>
douser@douser-PC:~/PycharmProjects/pyDjango$ python3 -m django --version
3.1.3
5.创建django 工程目录及查看工程目录下文件douser@douser-PC:~$ python3 -m django startproject mysite
douser@douser-PC:~$ ls
模板      Desktop    Downloads   Music   Pictures         tmp.text迅雷下载  Documents  Lightworks  mysite  PycharmProjects  Videosdouser@douser-PC:~/mysite$ ls
manage.py  mysitedouser@douser-PC:~/mysite$ douser@douser-PC:~/PycharmProjects/pyDjango$ cd mysite/mysite/douser@douser-PC:~/PycharmProjects/pyDjango/mysite/mysite$ lsasgi.py  __init__.py  settings.py  urls.py  wsgi.py
6.查看python3下django下的可用douser@douser-PC:~/PycharmProjects/pyDjango$ python3 -m djangoType 'python -m django help <subcommand>' for help on a specific subcommand.Available subcommands:[django]    check    compilemessages    createcachetable    dbshell    diffsettings    dumpdata    flush    inspectdb    loaddata    makemessages    makemigrations    migrate    runserver    sendtestemail    shell    showmigrations    sqlflush    sqlmigrate    sqlsequencereset    squashmigrations    startapp    startproject    test    testserverNote that only Django core commands are listed as settings are not properly configured (error: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.).    douser@douser-PC:~/PycharmProjects/pyDjango$
(0)

相关推荐