0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Djangoの学習①(Djangoのインストールからプロジェクトの動作確認まで)

Last updated at Posted at 2023-10-23

PythonのWebアプリケーションフレームワークDjangoを学習してみようと思いました。
ググってみたのですがあまり興味を惹かれる記事がなく
公式のTutorialを参考にすることにしました。

Djangoをpip(Pythonのパッケージ管理ツール)インストール

$ pip install django

Successfully installed asgiref-3.7.2 django-4.2.6 sqlparse-0.4.4 tzdata-2023.3

DjangoのVersionを確認

$ python -m django --version
4.2.6

プロジェクトの作成

$ django-admin startproject mysite

これで「mysite」という名称のディレクトリが作成されているはずです

以下のファイル構成になっていれば大丈夫

mysite/
    manage.py
    mysite/
        __init__.py
        settings.py
        urls.py
        asgi.py
        wsgi.py

Djangoプロジェクトが動作することを確認

manage.pyファイルのあるmysiteディレクトリにに移動。

$ cd mysite

サーバーを実行

$ python manage.py runserver


Django version 4.2.6, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

URLをクリックしてブラウザにアクセス

以下のような画像が表示されれば成功です
screencapture-127-0-0-1-8000-2023-10-24-03_40_38.png

続きは次回以降行います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?