LoginSignup
0
0

More than 1 year has passed since last update.

Djangoでプロジェクトを作成しローカルサーバーを起動してみた

Last updated at Posted at 2023-02-02

背景

2023年にエンジニアとして1円でも良いので仕事を取りたいという気持ちがありますが、どこから手をつければ良いのか分からない中でDjangoを扱えるようにがんばっています。毎日少しずつでも良いので学んだことや解決したことを蓄積していければと思っています。暖かい目で見守っていただければ嬉しいです。

そもそもマークダウンの書式が分からない…こちらこちらを見ながら。

やったこと

まずはプロジェクト作成

terminal(PJT作成したいフォルダ)
% django-admin startproject mysite

おまじないとして:

% cd mysite
% 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

この状態でローカルサーバーを動かせる

% python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
February 02, 2023 - 21:10:31
Django version 3.2.12, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

おめでとうございます!
スクリーンショット 2023-02-02 21.41.49.png

気づき

実はQiitaに書くかなり前にこの作業は終わっていた(当たり前)のだけど、プロジェクトを作っては躓いて進めなくなったり、違うことをやりたくなることも多く、ゼロからプロジェクトを作成することが少なくないため、まとめてみました。
次はアプリをつくり、モデルからDBを作成、管理サイトまでまとめようと思っています。

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