From 5e86c9769a7ee526bbbf984d96b376356e52447c Mon Sep 17 00:00:00 2001 From: youngkwangjoo Date: Mon, 29 Jul 2024 15:41:35 +0900 Subject: [PATCH 01/12] =?UTF-8?q?=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=EA=B0=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../potato_types/migrations/0001_initial.py | 14 ++++ .../stacks/migrations/0001_initial.py | 79 +++++++++++++------ 2 files changed, 68 insertions(+), 25 deletions(-) diff --git a/potato_project/potato_types/migrations/0001_initial.py b/potato_project/potato_types/migrations/0001_initial.py index 75eb67e..063238e 100644 --- a/potato_project/potato_types/migrations/0001_initial.py +++ b/potato_project/potato_types/migrations/0001_initial.py @@ -2,6 +2,19 @@ from django.db import migrations, models +def insert_initial_data(apps, schema_editor): + PotatoType = apps.get_model('potato_types', 'PotatoType') + PotatoType.objects.create(potato_name="levelOnePotato", potato_description="Can be obtained after level 1.") + PotatoType.objects.create(potato_name="levelTwoPotato", potato_description="Can be obtained after level 2.") + PotatoType.objects.create(potato_name="levelThreePotato", potato_description="Can be obtained after level 3.") + PotatoType.objects.create(potato_name="levelFourPotato", potato_description="Can be obtained after level 4.") + PotatoType.objects.create(potato_name="levelFivePotato", potato_description="Can be obtained after level 5.") + PotatoType.objects.create(potato_name="winterPotato", potato_description="Can be obtained by committing on Christmas Day.") + PotatoType.objects.create(potato_name="ghostPotato", potato_description="Can be obtained by committing on Halloween.") + PotatoType.objects.create(potato_name="crystalPotato", potato_description="Can be obtained by committing consecutively for a month.") + PotatoType.objects.create(potato_name="dirtyPotato", potato_description="Can be obtained if there are no commits for a month.") + PotatoType.objects.create(potato_name="greenPotato", potato_description="Can be obtained if there are no commits for 3 months.") + PotatoType.objects.create(potato_name="shPotato", potato_description="?") class Migration(migrations.Migration): @@ -33,4 +46,5 @@ class Migration(migrations.Migration): ("potato_description", models.TextField(verbose_name="감자설명")), ], ), + migrations.RunPython(insert_initial_data), ] diff --git a/potato_project/stacks/migrations/0001_initial.py b/potato_project/stacks/migrations/0001_initial.py index 96ba470..0f6d90d 100644 --- a/potato_project/stacks/migrations/0001_initial.py +++ b/potato_project/stacks/migrations/0001_initial.py @@ -1,31 +1,60 @@ -# Generated by Django 5.0.7 on 2024-07-28 14:09 - -from django.db import migrations, models +from django.db import migrations +def add_initial_stacks(apps, schema_editor): + Stack = apps.get_model('your_app_name', 'Stack') + stacks = [ + # 프로그래밍 언어 + "Python", "Java", "JavaScript", "TypeScript", "C++", "C#", "Ruby", "Go", "Rust", "Swift", + "Kotlin", "PHP", "Scala", "R", "Dart", "Lua", "Haskell", "Erlang", "Clojure", "F#", + + # 백엔드 프레임워크 + "Django", "Flask", "FastAPI", "Spring Boot", "Express.js", "Ruby on Rails", "ASP.NET Core", + "Laravel", "Symfony", "Phoenix", "Gin", "Echo", "Ktor", "Micronaut", "Quarkus", "NestJS", + "Strapi", "Koa.js", "Fastify", "Sails.js", + + # 프론트엔드 프레임워크/라이브러리 + "React", "Vue.js", "Angular", "Svelte", "Ember.js", "Backbone.js", "jQuery", "Preact", + "Solid.js", "Alpine.js", "Lit", "Stimulus", "Meteor", "Next.js", "Nuxt.js", "Gatsby", + "Gridsome", "Eleventy", "Astro", "Remix", + + # 모바일 개발 + "React Native", "Flutter", "Xamarin", "Ionic", "PhoneGap", "Cordova", "NativeScript", + "Kivy", "SwiftUI", "Jetpack Compose", "Unity", + + # 데이터베이스 + "PostgreSQL", "MySQL", "MongoDB", "SQLite", "Redis", "Cassandra", "Couchbase", "Oracle", + "Microsoft SQL Server", "MariaDB", "Elasticsearch", "Neo4j", "InfluxDB", "DynamoDB", + "Firestore", "Realm", "CockroachDB", "TimescaleDB", "RethinkDB", "ArangoDB", + + # 클라우드 플랫폼 + "AWS", "Google Cloud Platform", "Microsoft Azure", "Heroku", "DigitalOcean", "Linode", + "Vultr", "IBM Cloud", "Oracle Cloud", "Alibaba Cloud", + + # DevOps 및 인프라 + "Docker", "Kubernetes", "Jenkins", "GitLab CI/CD", "Travis CI", "CircleCI", "Ansible", + "Terraform", "Puppet", "Chef", "Vagrant", "Prometheus", "Grafana", "ELK Stack", "Nagios", "Zabbix", + + # 버전 관리 + "Git", "Mercurial", "SVN", + + # API 및 통신 + "REST API", "GraphQL", "gRPC", "WebSocket", "RabbitMQ", "Apache Kafka", "MQTT", "ZeroMQ", + + # 프론트엔드 도구 + "Webpack", "Babel", "Sass", "Less", "PostCSS", "Gulp", "Grunt", "Parcel", "Rollup", "Vite", + + # 테스팅 + "Jest", "Mocha", "Jasmine", "Selenium", "Cypress", "Puppeteer", "JUnit", "TestNG", "PyTest", "RSpec" + ] + for stack in stacks: + Stack.objects.create(name=stack) class Migration(migrations.Migration): - initial = True - - dependencies = [] + dependencies = [ + ('your_app_name', '0001_initial'), + ] operations = [ - migrations.CreateModel( - name="Stack", - fields=[ - ( - "id", - models.BigAutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ( - "name", - models.CharField(max_length=20, null=True, verbose_name="스택명"), - ), - ], - ), - ] + migrations.RunPython(add_initial_stacks), + ] \ No newline at end of file From 08cfcd47b1728ea79f6d432f4fbb01a7c6eace1d Mon Sep 17 00:00:00 2001 From: youngkwangjoo Date: Mon, 29 Jul 2024 15:48:57 +0900 Subject: [PATCH 02/12] =?UTF-8?q?=20=EC=98=A4=ED=83=80=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- potato_project/stacks/migrations/0001_initial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/potato_project/stacks/migrations/0001_initial.py b/potato_project/stacks/migrations/0001_initial.py index 0f6d90d..62b912d 100644 --- a/potato_project/stacks/migrations/0001_initial.py +++ b/potato_project/stacks/migrations/0001_initial.py @@ -1,7 +1,7 @@ from django.db import migrations def add_initial_stacks(apps, schema_editor): - Stack = apps.get_model('your_app_name', 'Stack') + Stack = apps.get_model('stacks', 'Stack') stacks = [ # 프로그래밍 언어 "Python", "Java", "JavaScript", "TypeScript", "C++", "C#", "Ruby", "Go", "Rust", "Swift", From a83f1a64a70431bb2a836bb4082fd0b493f5454a Mon Sep 17 00:00:00 2001 From: youngkwangjoo Date: Mon, 29 Jul 2024 15:59:42 +0900 Subject: [PATCH 03/12] =?UTF-8?q?=20=EC=98=A4=ED=83=80=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- potato_project/potato_types/migrations/0001_initial.py | 2 +- potato_project/stacks/migrations/0001_initial.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/potato_project/potato_types/migrations/0001_initial.py b/potato_project/potato_types/migrations/0001_initial.py index 063238e..cf2c08a 100644 --- a/potato_project/potato_types/migrations/0001_initial.py +++ b/potato_project/potato_types/migrations/0001_initial.py @@ -2,7 +2,7 @@ from django.db import migrations, models -def insert_initial_data(apps, schema_editor): +def insert_initial_data(potato_types, schema_editor): PotatoType = apps.get_model('potato_types', 'PotatoType') PotatoType.objects.create(potato_name="levelOnePotato", potato_description="Can be obtained after level 1.") PotatoType.objects.create(potato_name="levelTwoPotato", potato_description="Can be obtained after level 2.") diff --git a/potato_project/stacks/migrations/0001_initial.py b/potato_project/stacks/migrations/0001_initial.py index 62b912d..23feec2 100644 --- a/potato_project/stacks/migrations/0001_initial.py +++ b/potato_project/stacks/migrations/0001_initial.py @@ -52,7 +52,7 @@ def add_initial_stacks(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('your_app_name', '0001_initial'), + ('stacks', '0001_initial'), ] operations = [ From 98374b4f7beede255d2e804b2aaf0333478284a6 Mon Sep 17 00:00:00 2001 From: youngkwangjoo Date: Mon, 29 Jul 2024 16:03:09 +0900 Subject: [PATCH 04/12] =?UTF-8?q?=20=EC=98=A4=ED=83=80=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- potato_project/stacks/migrations/0001_initial.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/potato_project/stacks/migrations/0001_initial.py b/potato_project/stacks/migrations/0001_initial.py index 23feec2..71a0396 100644 --- a/potato_project/stacks/migrations/0001_initial.py +++ b/potato_project/stacks/migrations/0001_initial.py @@ -51,9 +51,7 @@ def add_initial_stacks(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ - ('stacks', '0001_initial'), - ] + dependencies = [] operations = [ migrations.RunPython(add_initial_stacks), From a62039b0db2810c66d7b14393bd59c6037f5c9d6 Mon Sep 17 00:00:00 2001 From: youngkwangjoo Date: Mon, 29 Jul 2024 16:33:55 +0900 Subject: [PATCH 05/12] =?UTF-8?q?=20migrations=20=EB=B6=84=ED=95=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../potato_types/migrations/0001_initial.py | 19 ++---- .../migrations/0002_add_initial_data.py | 25 +++++++ .../stacks/migrations/0001_initial.py | 67 +++++-------------- .../migrations/0002_add_initial_stacks.py | 60 +++++++++++++++++ potato_project/user_stacks/models.py | 4 +- 5 files changed, 106 insertions(+), 69 deletions(-) create mode 100644 potato_project/potato_types/migrations/0002_add_initial_data.py create mode 100644 potato_project/stacks/migrations/0002_add_initial_stacks.py diff --git a/potato_project/potato_types/migrations/0001_initial.py b/potato_project/potato_types/migrations/0001_initial.py index cf2c08a..f4bac5f 100644 --- a/potato_project/potato_types/migrations/0001_initial.py +++ b/potato_project/potato_types/migrations/0001_initial.py @@ -2,20 +2,6 @@ from django.db import migrations, models -def insert_initial_data(potato_types, schema_editor): - PotatoType = apps.get_model('potato_types', 'PotatoType') - PotatoType.objects.create(potato_name="levelOnePotato", potato_description="Can be obtained after level 1.") - PotatoType.objects.create(potato_name="levelTwoPotato", potato_description="Can be obtained after level 2.") - PotatoType.objects.create(potato_name="levelThreePotato", potato_description="Can be obtained after level 3.") - PotatoType.objects.create(potato_name="levelFourPotato", potato_description="Can be obtained after level 4.") - PotatoType.objects.create(potato_name="levelFivePotato", potato_description="Can be obtained after level 5.") - PotatoType.objects.create(potato_name="winterPotato", potato_description="Can be obtained by committing on Christmas Day.") - PotatoType.objects.create(potato_name="ghostPotato", potato_description="Can be obtained by committing on Halloween.") - PotatoType.objects.create(potato_name="crystalPotato", potato_description="Can be obtained by committing consecutively for a month.") - PotatoType.objects.create(potato_name="dirtyPotato", potato_description="Can be obtained if there are no commits for a month.") - PotatoType.objects.create(potato_name="greenPotato", potato_description="Can be obtained if there are no commits for 3 months.") - PotatoType.objects.create(potato_name="shPotato", potato_description="?") - class Migration(migrations.Migration): initial = True @@ -45,6 +31,9 @@ class Migration(migrations.Migration): ), ("potato_description", models.TextField(verbose_name="감자설명")), ], + options={ + "verbose_name": "PotatoType", + "verbose_name_plural": "PotatoTypes", + }, ), - migrations.RunPython(insert_initial_data), ] diff --git a/potato_project/potato_types/migrations/0002_add_initial_data.py b/potato_project/potato_types/migrations/0002_add_initial_data.py new file mode 100644 index 0000000..2ad1896 --- /dev/null +++ b/potato_project/potato_types/migrations/0002_add_initial_data.py @@ -0,0 +1,25 @@ +from django.db import migrations + +def insert_initial_data(apps, schema_editor): + PotatoType = apps.get_model('potato_types', 'PotatoType') + PotatoType.objects.create(potato_name="levelOnePotato", potato_description="Can be obtained after level 1.") + PotatoType.objects.create(potato_name="levelTwoPotato", potato_description="Can be obtained after level 2.") + PotatoType.objects.create(potato_name="levelThreePotato", potato_description="Can be obtained after level 3.") + PotatoType.objects.create(potato_name="levelFourPotato", potato_description="Can be obtained after level 4.") + PotatoType.objects.create(potato_name="levelFivePotato", potato_description="Can be obtained after level 5.") + PotatoType.objects.create(potato_name="winterPotato", potato_description="Can be obtained by committing on Christmas Day.") + PotatoType.objects.create(potato_name="ghostPotato", potato_description="Can be obtained by committing on Halloween.") + PotatoType.objects.create(potato_name="crystalPotato", potato_description="Can be obtained by committing consecutively for a month.") + PotatoType.objects.create(potato_name="dirtyPotato", potato_description="Can be obtained if there are no commits for a month.") + PotatoType.objects.create(potato_name="greenPotato", potato_description="Can be obtained if there are no commits for 3 months.") + PotatoType.objects.create(potato_name="shPotato", potato_description="?") + +class Migration(migrations.Migration): + + dependencies = [ + ("potato_types", "0001_initial"), # "0001_initial"은 모델 생성 마이그레이션의 이름입니다. + ] + + operations = [ + migrations.RunPython(insert_initial_data), + ] diff --git a/potato_project/stacks/migrations/0001_initial.py b/potato_project/stacks/migrations/0001_initial.py index 71a0396..202286e 100644 --- a/potato_project/stacks/migrations/0001_initial.py +++ b/potato_project/stacks/migrations/0001_initial.py @@ -1,58 +1,21 @@ -from django.db import migrations - -def add_initial_stacks(apps, schema_editor): - Stack = apps.get_model('stacks', 'Stack') - stacks = [ - # 프로그래밍 언어 - "Python", "Java", "JavaScript", "TypeScript", "C++", "C#", "Ruby", "Go", "Rust", "Swift", - "Kotlin", "PHP", "Scala", "R", "Dart", "Lua", "Haskell", "Erlang", "Clojure", "F#", - - # 백엔드 프레임워크 - "Django", "Flask", "FastAPI", "Spring Boot", "Express.js", "Ruby on Rails", "ASP.NET Core", - "Laravel", "Symfony", "Phoenix", "Gin", "Echo", "Ktor", "Micronaut", "Quarkus", "NestJS", - "Strapi", "Koa.js", "Fastify", "Sails.js", - - # 프론트엔드 프레임워크/라이브러리 - "React", "Vue.js", "Angular", "Svelte", "Ember.js", "Backbone.js", "jQuery", "Preact", - "Solid.js", "Alpine.js", "Lit", "Stimulus", "Meteor", "Next.js", "Nuxt.js", "Gatsby", - "Gridsome", "Eleventy", "Astro", "Remix", - - # 모바일 개발 - "React Native", "Flutter", "Xamarin", "Ionic", "PhoneGap", "Cordova", "NativeScript", - "Kivy", "SwiftUI", "Jetpack Compose", "Unity", - - # 데이터베이스 - "PostgreSQL", "MySQL", "MongoDB", "SQLite", "Redis", "Cassandra", "Couchbase", "Oracle", - "Microsoft SQL Server", "MariaDB", "Elasticsearch", "Neo4j", "InfluxDB", "DynamoDB", - "Firestore", "Realm", "CockroachDB", "TimescaleDB", "RethinkDB", "ArangoDB", - - # 클라우드 플랫폼 - "AWS", "Google Cloud Platform", "Microsoft Azure", "Heroku", "DigitalOcean", "Linode", - "Vultr", "IBM Cloud", "Oracle Cloud", "Alibaba Cloud", - - # DevOps 및 인프라 - "Docker", "Kubernetes", "Jenkins", "GitLab CI/CD", "Travis CI", "CircleCI", "Ansible", - "Terraform", "Puppet", "Chef", "Vagrant", "Prometheus", "Grafana", "ELK Stack", "Nagios", "Zabbix", - - # 버전 관리 - "Git", "Mercurial", "SVN", - - # API 및 통신 - "REST API", "GraphQL", "gRPC", "WebSocket", "RabbitMQ", "Apache Kafka", "MQTT", "ZeroMQ", - - # 프론트엔드 도구 - "Webpack", "Babel", "Sass", "Less", "PostCSS", "Gulp", "Grunt", "Parcel", "Rollup", "Vite", - - # 테스팅 - "Jest", "Mocha", "Jasmine", "Selenium", "Cypress", "Puppeteer", "JUnit", "TestNG", "PyTest", "RSpec" - ] - for stack in stacks: - Stack.objects.create(name=stack) +from django.db import migrations, models class Migration(migrations.Migration): + initial = True + dependencies = [] operations = [ - migrations.RunPython(add_initial_stacks), - ] \ No newline at end of file + migrations.CreateModel( + name="Stack", + fields=[ + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=255, verbose_name="스택이름")), + ], + options={ + "verbose_name": "Stack", + "verbose_name_plural": "Stacks", + }, + ), + ] diff --git a/potato_project/stacks/migrations/0002_add_initial_stacks.py b/potato_project/stacks/migrations/0002_add_initial_stacks.py new file mode 100644 index 0000000..ea1a861 --- /dev/null +++ b/potato_project/stacks/migrations/0002_add_initial_stacks.py @@ -0,0 +1,60 @@ +from django.db import migrations + +def add_initial_stacks(apps, schema_editor): + Stack = apps.get_model('stacks', 'Stack') + stacks = [ + # 프로그래밍 언어 + "Python", "Java", "JavaScript", "TypeScript", "C++", "C#", "Ruby", "Go", "Rust", "Swift", + "Kotlin", "PHP", "Scala", "R", "Dart", "Lua", "Haskell", "Erlang", "Clojure", "F#", + + # 백엔드 프레임워크 + "Django", "Flask", "FastAPI", "Spring Boot", "Express.js", "Ruby on Rails", "ASP.NET Core", + "Laravel", "Symfony", "Phoenix", "Gin", "Echo", "Ktor", "Micronaut", "Quarkus", "NestJS", + "Strapi", "Koa.js", "Fastify", "Sails.js", + + # 프론트엔드 프레임워크/라이브러리 + "React", "Vue.js", "Angular", "Svelte", "Ember.js", "Backbone.js", "jQuery", "Preact", + "Solid.js", "Alpine.js", "Lit", "Stimulus", "Meteor", "Next.js", "Nuxt.js", "Gatsby", + "Gridsome", "Eleventy", "Astro", "Remix", + + # 모바일 개발 + "React Native", "Flutter", "Xamarin", "Ionic", "PhoneGap", "Cordova", "NativeScript", + "Kivy", "SwiftUI", "Jetpack Compose", "Unity", + + # 데이터베이스 + "PostgreSQL", "MySQL", "MongoDB", "SQLite", "Redis", "Cassandra", "Couchbase", "Oracle", + "Microsoft SQL Server", "MariaDB", "Elasticsearch", "Neo4j", "InfluxDB", "DynamoDB", + "Firestore", "Realm", "CockroachDB", "TimescaleDB", "RethinkDB", "ArangoDB", + + # 클라우드 플랫폼 + "AWS", "Google Cloud Platform", "Microsoft Azure", "Heroku", "DigitalOcean", "Linode", + "Vultr", "IBM Cloud", "Oracle Cloud", "Alibaba Cloud", + + # DevOps 및 인프라 + "Docker", "Kubernetes", "Jenkins", "GitLab CI/CD", "Travis CI", "CircleCI", "Ansible", + "Terraform", "Puppet", "Chef", "Vagrant", "Prometheus", "Grafana", "ELK Stack", "Nagios", "Zabbix", + + # 버전 관리 + "Git", "Mercurial", "SVN", + + # API 및 통신 + "REST API", "GraphQL", "gRPC", "WebSocket", "RabbitMQ", "Apache Kafka", "MQTT", "ZeroMQ", + + # 프론트엔드 도구 + "Webpack", "Babel", "Sass", "Less", "PostCSS", "Gulp", "Grunt", "Parcel", "Rollup", "Vite", + + # 테스팅 + "Jest", "Mocha", "Jasmine", "Selenium", "Cypress", "Puppeteer", "JUnit", "TestNG", "PyTest", "RSpec" + ] + for stack in stacks: + Stack.objects.create(name=stack) + +class Migration(migrations.Migration): + + dependencies = [ + ('stacks', '0001_initial'), + ] + + operations = [ + migrations.RunPython(add_initial_stacks), + ] diff --git a/potato_project/user_stacks/models.py b/potato_project/user_stacks/models.py index 23e73b8..d508845 100644 --- a/potato_project/user_stacks/models.py +++ b/potato_project/user_stacks/models.py @@ -10,7 +10,7 @@ class UserStack(TimeStampedModel): def __str__(self): return ( - f"{self.user_id.username} - {self.stack_id}" - if f"{self.user_id.username} - {self.stack_id}" + f"{self.user.username} - {self.stack}" + if f"{self.user.username} - {self.stack}" else "배워가는 감자에요" ) From d35454b2945f37d3c658185eed983604a3495676 Mon Sep 17 00:00:00 2001 From: youngkwangjoo Date: Mon, 29 Jul 2024 18:11:50 +0900 Subject: [PATCH 06/12] =?UTF-8?q?=20stacks=20models.py=20=EA=B8=B8?= =?UTF-8?q?=EC=9D=B4=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- potato_project/stacks/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/potato_project/stacks/models.py b/potato_project/stacks/models.py index 962d008..2c8c430 100644 --- a/potato_project/stacks/models.py +++ b/potato_project/stacks/models.py @@ -2,7 +2,7 @@ class Stack(models.Model): - name = models.CharField(max_length=20, null=True, verbose_name="스택명") + name = models.CharField(max_length=50, null=True, verbose_name="스택명") def __str__(self): return self.name From 65e05a030cd56ac3404f1f94e4d21b7eb66ead9f Mon Sep 17 00:00:00 2001 From: dayeonkimm Date: Tue, 30 Jul 2024 11:46:23 +0900 Subject: [PATCH 07/12] =?UTF-8?q?migration=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0002_add_initial_data.py | 25 ++++++++ .../migrations/0002_add_initial_stacks.py | 60 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 potato_project/potato_types/migrations/0002_add_initial_data.py create mode 100644 potato_project/stacks/migrations/0002_add_initial_stacks.py diff --git a/potato_project/potato_types/migrations/0002_add_initial_data.py b/potato_project/potato_types/migrations/0002_add_initial_data.py new file mode 100644 index 0000000..2ad1896 --- /dev/null +++ b/potato_project/potato_types/migrations/0002_add_initial_data.py @@ -0,0 +1,25 @@ +from django.db import migrations + +def insert_initial_data(apps, schema_editor): + PotatoType = apps.get_model('potato_types', 'PotatoType') + PotatoType.objects.create(potato_name="levelOnePotato", potato_description="Can be obtained after level 1.") + PotatoType.objects.create(potato_name="levelTwoPotato", potato_description="Can be obtained after level 2.") + PotatoType.objects.create(potato_name="levelThreePotato", potato_description="Can be obtained after level 3.") + PotatoType.objects.create(potato_name="levelFourPotato", potato_description="Can be obtained after level 4.") + PotatoType.objects.create(potato_name="levelFivePotato", potato_description="Can be obtained after level 5.") + PotatoType.objects.create(potato_name="winterPotato", potato_description="Can be obtained by committing on Christmas Day.") + PotatoType.objects.create(potato_name="ghostPotato", potato_description="Can be obtained by committing on Halloween.") + PotatoType.objects.create(potato_name="crystalPotato", potato_description="Can be obtained by committing consecutively for a month.") + PotatoType.objects.create(potato_name="dirtyPotato", potato_description="Can be obtained if there are no commits for a month.") + PotatoType.objects.create(potato_name="greenPotato", potato_description="Can be obtained if there are no commits for 3 months.") + PotatoType.objects.create(potato_name="shPotato", potato_description="?") + +class Migration(migrations.Migration): + + dependencies = [ + ("potato_types", "0001_initial"), # "0001_initial"은 모델 생성 마이그레이션의 이름입니다. + ] + + operations = [ + migrations.RunPython(insert_initial_data), + ] diff --git a/potato_project/stacks/migrations/0002_add_initial_stacks.py b/potato_project/stacks/migrations/0002_add_initial_stacks.py new file mode 100644 index 0000000..ea1a861 --- /dev/null +++ b/potato_project/stacks/migrations/0002_add_initial_stacks.py @@ -0,0 +1,60 @@ +from django.db import migrations + +def add_initial_stacks(apps, schema_editor): + Stack = apps.get_model('stacks', 'Stack') + stacks = [ + # 프로그래밍 언어 + "Python", "Java", "JavaScript", "TypeScript", "C++", "C#", "Ruby", "Go", "Rust", "Swift", + "Kotlin", "PHP", "Scala", "R", "Dart", "Lua", "Haskell", "Erlang", "Clojure", "F#", + + # 백엔드 프레임워크 + "Django", "Flask", "FastAPI", "Spring Boot", "Express.js", "Ruby on Rails", "ASP.NET Core", + "Laravel", "Symfony", "Phoenix", "Gin", "Echo", "Ktor", "Micronaut", "Quarkus", "NestJS", + "Strapi", "Koa.js", "Fastify", "Sails.js", + + # 프론트엔드 프레임워크/라이브러리 + "React", "Vue.js", "Angular", "Svelte", "Ember.js", "Backbone.js", "jQuery", "Preact", + "Solid.js", "Alpine.js", "Lit", "Stimulus", "Meteor", "Next.js", "Nuxt.js", "Gatsby", + "Gridsome", "Eleventy", "Astro", "Remix", + + # 모바일 개발 + "React Native", "Flutter", "Xamarin", "Ionic", "PhoneGap", "Cordova", "NativeScript", + "Kivy", "SwiftUI", "Jetpack Compose", "Unity", + + # 데이터베이스 + "PostgreSQL", "MySQL", "MongoDB", "SQLite", "Redis", "Cassandra", "Couchbase", "Oracle", + "Microsoft SQL Server", "MariaDB", "Elasticsearch", "Neo4j", "InfluxDB", "DynamoDB", + "Firestore", "Realm", "CockroachDB", "TimescaleDB", "RethinkDB", "ArangoDB", + + # 클라우드 플랫폼 + "AWS", "Google Cloud Platform", "Microsoft Azure", "Heroku", "DigitalOcean", "Linode", + "Vultr", "IBM Cloud", "Oracle Cloud", "Alibaba Cloud", + + # DevOps 및 인프라 + "Docker", "Kubernetes", "Jenkins", "GitLab CI/CD", "Travis CI", "CircleCI", "Ansible", + "Terraform", "Puppet", "Chef", "Vagrant", "Prometheus", "Grafana", "ELK Stack", "Nagios", "Zabbix", + + # 버전 관리 + "Git", "Mercurial", "SVN", + + # API 및 통신 + "REST API", "GraphQL", "gRPC", "WebSocket", "RabbitMQ", "Apache Kafka", "MQTT", "ZeroMQ", + + # 프론트엔드 도구 + "Webpack", "Babel", "Sass", "Less", "PostCSS", "Gulp", "Grunt", "Parcel", "Rollup", "Vite", + + # 테스팅 + "Jest", "Mocha", "Jasmine", "Selenium", "Cypress", "Puppeteer", "JUnit", "TestNG", "PyTest", "RSpec" + ] + for stack in stacks: + Stack.objects.create(name=stack) + +class Migration(migrations.Migration): + + dependencies = [ + ('stacks', '0001_initial'), + ] + + operations = [ + migrations.RunPython(add_initial_stacks), + ] From de6871b422a99c8813dfc4f34ea82e2cb72ec76d Mon Sep 17 00:00:00 2001 From: dayeonkimm Date: Tue, 30 Jul 2024 11:54:00 +0900 Subject: [PATCH 08/12] =?UTF-8?q?=EC=84=A4=EC=A0=95=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EB=B0=B0=ED=8F=AC=EC=9A=A9=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 97 ++++++++++++++++++++-------------- docker-compose.yml | 95 +++++++++++++++++---------------- potato_project/app/settings.py | 34 ++++++------ 3 files changed, 125 insertions(+), 101 deletions(-) diff --git a/Dockerfile b/Dockerfile index 861bddd..8fb6ca7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ +# 배포용 + FROM python:3.11-alpine3.19 # LABEL 명령어는 이미지에 메타데이터를 추가합니다. 여기서는 이미지의 유지 관리자를 "dayeonkim"로 지정하고 있습니다. @@ -8,58 +10,24 @@ LABEL maintainer="frog" # 이는 Docker 컨테이너에서 로그를 더 쉽게 볼 수 있게 합니다. ENV PYTHONUNBUFFERED 1 -# # 로컬 파일 시스템의 requirements.txt 파일을 컨테이너의 /tmp/requirements.txt로 복사합니다. -# # 이 파일은 필요한 Python 패키지들을 명시합니다. -# COPY ./requirements.txt /tmp/requirements.txt -# COPY ./potato_project /app -# WORKDIR /app -# EXPOSE 8000 - -# # ARG DEV=false - -# RUN python -m venv /py && \ -# /py/bin/pip install --upgrade pip && \ -# /py/bin/pip install -r /tmp/requirements.txt && \ -# apk add --update --no-cache jpeg-dev && \ -# apk add --update --no-cache --virtual .tmp-build-deps \ -# build-base musl-dev zlib zlib-dev linux-headers && \ -# # if [ $DEV = "true" ]; \ -# # then /py/bin/pip install -r /tmp/requirements.dev.txt ; \ -# # fi && \ -# rm -rf /tmp && \ -# apk del .tmp-build-deps && \ -# adduser \ -# --disabled-password \ -# --no-create-home \ -# django-user - -# ENV PATH="/py/bin:$PATH" - -# USER django-user - -# # 이 명령어를 추가하여 pytest를 설치합니다. -# RUN /py/bin/pip install pytest pytest-django - - # 로컬 파일 시스템의 requirements.txt 파일을 컨테이너의 /tmp/requirements.txt로 복사합니다. # 이 파일은 필요한 Python 패키지들을 명시합니다. COPY ./requirements.txt /tmp/requirements.txt -COPY ./requirements.dev.txt /tmp/requirements.dev.txt COPY ./potato_project /app WORKDIR /app EXPOSE 8000 -ARG DEV=false +# ARG DEV=false RUN python -m venv /py && \ /py/bin/pip install --upgrade pip && \ /py/bin/pip install -r /tmp/requirements.txt && \ - apk add --update --no-cache postgresql-client jpeg-dev && \ + apk add --update --no-cache jpeg-dev && \ apk add --update --no-cache --virtual .tmp-build-deps \ - build-base postgresql-dev musl-dev zlib zlib-dev linux-headers && \ - if [ $DEV = "true" ]; \ - then /py/bin/pip install -r /tmp/requirements.dev.txt ; \ - fi && \ + build-base musl-dev zlib zlib-dev linux-headers && \ + # if [ $DEV = "true" ]; \ + # then /py/bin/pip install -r /tmp/requirements.dev.txt ; \ + # fi && \ rm -rf /tmp && \ apk del .tmp-build-deps && \ adduser \ @@ -72,4 +40,51 @@ ENV PATH="/py/bin:$PATH" USER django-user # 이 명령어를 추가하여 pytest를 설치합니다. -RUN /py/bin/pip install pytest pytest-django \ No newline at end of file +RUN /py/bin/pip install pytest pytest-django + + +# 개발용 + +# FROM python:3.11-alpine3.19 + +# # LABEL 명령어는 이미지에 메타데이터를 추가합니다. 여기서는 이미지의 유지 관리자를 "dayeonkim"로 지정하고 있습니다. +# LABEL maintainer="frog" + +# # 환경 변수 PYTHONUNBUFFERED를 1로 설정합니다. +# # 이는 Python이 표준 입출력 버퍼링을 비활성화하게 하여, 로그가 즉시 콘솔에 출력되게 합니다. +# # 이는 Docker 컨테이너에서 로그를 더 쉽게 볼 수 있게 합니다. +# ENV PYTHONUNBUFFERED 1 + + +# # 로컬 파일 시스템의 requirements.txt 파일을 컨테이너의 /tmp/requirements.txt로 복사합니다. +# # 이 파일은 필요한 Python 패키지들을 명시합니다. +# COPY ./requirements.txt /tmp/requirements.txt +# COPY ./requirements.dev.txt /tmp/requirements.dev.txt +# COPY ./potato_project /app +# WORKDIR /app +# EXPOSE 8000 + +# ARG DEV=false + +# RUN python -m venv /py && \ +# /py/bin/pip install --upgrade pip && \ +# /py/bin/pip install -r /tmp/requirements.txt && \ +# apk add --update --no-cache postgresql-client jpeg-dev && \ +# apk add --update --no-cache --virtual .tmp-build-deps \ +# build-base postgresql-dev musl-dev zlib zlib-dev linux-headers && \ +# if [ $DEV = "true" ]; \ +# then /py/bin/pip install -r /tmp/requirements.dev.txt ; \ +# fi && \ +# rm -rf /tmp && \ +# apk del .tmp-build-deps && \ +# adduser \ +# --disabled-password \ +# --no-create-home \ +# django-user + +# ENV PATH="/py/bin:$PATH" + +# USER django-user + +# # 이 명령어를 추가하여 pytest를 설치합니다. +# RUN /py/bin/pip install pytest pytest-django \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 052c4cb..372dcda 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,25 +1,4 @@ -# # version: "3.11" -# services: -# app: -# build: -# context: . -# args: -# - DEV=true -# ports: -# - "8000:8000" -# volumes: -# - ./potato_project:/app -# command: > -# sh -c "python manage.py makemigrations && -# python manage.py migrate && -# python manage.py runserver --noreload 0.0.0.0:8000" -# environment: -# - DB_HOST=${RDS_HOSTNAME} # RDS 엔드포인트 -# - DB_NAME=${RDS_DB_NAME} -# - DB_USER=${RDS_USERNAME} -# - DB_PASSWORD=${RDS_PASSWORD} -# env_file: -# - .env +# 배포용 # version: "3.11" services: @@ -30,35 +9,61 @@ services: - DEV=true ports: - "8000:8000" - - "3000:3000" # debugger volumes: - ./potato_project:/app command: > - sh -c "python manage.py wait_for_db && - python manage.py makemigrations && - python manage.py migrate && - python -u manage.py runserver --noreload 0.0.0.0:8000" + sh -c "python manage.py makemigrations && + python manage.py migrate && + python manage.py runserver --noreload 0.0.0.0:8000" environment: - - DB_HOST=${DB_HOST} - - DB_NAME=${DB_NAME} - - DB_USER=${DB_USER} - - DB_PASSWORD=${DB_PASSWORD} - - PYDEVD_DISABLE_FILE_VALIDATION=1 + - DB_HOST=${RDS_HOSTNAME} # RDS 엔드포인트 + - DB_NAME=${RDS_DB_NAME} + - DB_USER=${RDS_USERNAME} + - DB_PASSWORD=${RDS_PASSWORD} env_file: - - .env - depends_on: - - db + - .env + + +# 개발용 + +# # version: "3.11" +# services: +# app: +# build: +# context: . +# args: +# - DEV=true +# ports: +# - "8000:8000" +# - "3000:3000" # debugger +# volumes: +# - ./potato_project:/app +# command: > +# sh -c "python manage.py wait_for_db && +# python manage.py makemigrations && +# python manage.py migrate && +# python -u manage.py runserver --noreload 0.0.0.0:8000" +# environment: +# - DB_HOST=${DB_HOST} +# - DB_NAME=${DB_NAME} +# - DB_USER=${DB_USER} +# - DB_PASSWORD=${DB_PASSWORD} +# - PYDEVD_DISABLE_FILE_VALIDATION=1 +# env_file: +# - .env +# depends_on: +# - db - db: # PostgreSQL Database - image: postgres:16-alpine - volumes: - - ./data/db:/var/lib/postgresql/data - environment: - - POSTGRES_DB=${POSTGRES_DB} - - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - env_file: - - .env +# db: # PostgreSQL Database +# image: postgres:16-alpine +# volumes: +# - ./data/db:/var/lib/postgresql/data +# environment: +# - POSTGRES_DB=${POSTGRES_DB} +# - POSTGRES_USER=${POSTGRES_USER} +# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} +# env_file: +# - .env diff --git a/potato_project/app/settings.py b/potato_project/app/settings.py index e1be6fe..51d92c1 100644 --- a/potato_project/app/settings.py +++ b/potato_project/app/settings.py @@ -104,29 +104,33 @@ # WSGI 애플리케이션 설정 WSGI_APPLICATION = "app.wsgi.application" -# # 데이터베이스 설정 -# DATABASES = { -# "default": { -# "ENGINE": "django.db.backends.postgresql", -# "HOST": os.environ.get("RDS_HOSTNAME"), -# "NAME": os.environ.get("RDS_DB_NAME"), -# "USER": os.environ.get("RDS_USERNAME"), -# "PASSWORD": os.environ.get("RDS_PASSWORD"), -# "PORT": os.environ.get("RDS_PORT", 5432), -# } -# } +# 배포용 # 데이터베이스 설정 DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql", - "HOST": os.environ.get("DB_HOST"), - "NAME": os.environ.get("DB_NAME"), - "USER": os.environ.get("DB_USER"), - "PASSWORD": os.environ.get("DB_PASSWORD"), + "HOST": os.environ.get("RDS_HOSTNAME"), + "NAME": os.environ.get("RDS_DB_NAME"), + "USER": os.environ.get("RDS_USERNAME"), + "PASSWORD": os.environ.get("RDS_PASSWORD"), + "PORT": os.environ.get("RDS_PORT", 5432), } } +# 개발용 + +# # 데이터베이스 설정 +# DATABASES = { +# "default": { +# "ENGINE": "django.db.backends.postgresql", +# "HOST": os.environ.get("DB_HOST"), +# "NAME": os.environ.get("DB_NAME"), +# "USER": os.environ.get("DB_USER"), +# "PASSWORD": os.environ.get("DB_PASSWORD"), +# } +# } + # 비밀번호 검증 설정 AUTH_PASSWORD_VALIDATORS = [ { From ee3c8b2e0fefddcf96684307c18ddf55884e1a5c Mon Sep 17 00:00:00 2001 From: dayeonkimm Date: Tue, 30 Jul 2024 12:05:07 +0900 Subject: [PATCH 09/12] =?UTF-8?q?migration=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... => 0003_remove_potatotype_potato_image.py} | 0 ...rename_potato_type_id_potato_potato_type.py | 18 ------------------ 2 files changed, 18 deletions(-) rename potato_project/potato_types/migrations/{0002_remove_potatotype_potato_image.py => 0003_remove_potatotype_potato_image.py} (100%) delete mode 100644 potato_project/potatoes/migrations/0003_rename_potato_type_id_potato_potato_type.py diff --git a/potato_project/potato_types/migrations/0002_remove_potatotype_potato_image.py b/potato_project/potato_types/migrations/0003_remove_potatotype_potato_image.py similarity index 100% rename from potato_project/potato_types/migrations/0002_remove_potatotype_potato_image.py rename to potato_project/potato_types/migrations/0003_remove_potatotype_potato_image.py diff --git a/potato_project/potatoes/migrations/0003_rename_potato_type_id_potato_potato_type.py b/potato_project/potatoes/migrations/0003_rename_potato_type_id_potato_potato_type.py deleted file mode 100644 index 0ed4a23..0000000 --- a/potato_project/potatoes/migrations/0003_rename_potato_type_id_potato_potato_type.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.7 on 2024-07-29 14:59 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("potatoes", "0002_initial"), - ] - - operations = [ - migrations.RenameField( - model_name="potato", - old_name="potato_type_id", - new_name="potato_type", - ), - ] From b0ccd287063f8457c6ba211dc92bf1fe4c409e01 Mon Sep 17 00:00:00 2001 From: dayeonkimm Date: Tue, 30 Jul 2024 12:17:21 +0900 Subject: [PATCH 10/12] =?UTF-8?q?migration=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ype_potato_image.py => 0004_remove_potatotype_potato_image.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename potato_project/potato_types/migrations/{0003_remove_potatotype_potato_image.py => 0004_remove_potatotype_potato_image.py} (100%) diff --git a/potato_project/potato_types/migrations/0003_remove_potatotype_potato_image.py b/potato_project/potato_types/migrations/0004_remove_potatotype_potato_image.py similarity index 100% rename from potato_project/potato_types/migrations/0003_remove_potatotype_potato_image.py rename to potato_project/potato_types/migrations/0004_remove_potatotype_potato_image.py From 50a632a67371f081f0a03a98d05a68267d6ef93b Mon Sep 17 00:00:00 2001 From: dayeonkimm Date: Tue, 30 Jul 2024 12:20:42 +0900 Subject: [PATCH 11/12] =?UTF-8?q?migration=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_potato_image.py => 0003_remove_potatotype_potato_image.py} | 0 potato_project/stacks/models.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename potato_project/potato_types/migrations/{0004_remove_potatotype_potato_image.py => 0003_remove_potatotype_potato_image.py} (100%) diff --git a/potato_project/potato_types/migrations/0004_remove_potatotype_potato_image.py b/potato_project/potato_types/migrations/0003_remove_potatotype_potato_image.py similarity index 100% rename from potato_project/potato_types/migrations/0004_remove_potatotype_potato_image.py rename to potato_project/potato_types/migrations/0003_remove_potatotype_potato_image.py diff --git a/potato_project/stacks/models.py b/potato_project/stacks/models.py index 962d008..b8f944a 100644 --- a/potato_project/stacks/models.py +++ b/potato_project/stacks/models.py @@ -2,7 +2,7 @@ class Stack(models.Model): - name = models.CharField(max_length=20, null=True, verbose_name="스택명") + name = models.CharField(max_length=255, null=True, verbose_name="스택명") def __str__(self): return self.name From 54e1c3bea710559da7a149ab6c480341ed390349 Mon Sep 17 00:00:00 2001 From: dayeonkimm Date: Tue, 30 Jul 2024 12:25:17 +0900 Subject: [PATCH 12/12] =?UTF-8?q?migration=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- potato_project/stacks/migrations/0001_initial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/potato_project/stacks/migrations/0001_initial.py b/potato_project/stacks/migrations/0001_initial.py index 96ba470..c78aa8c 100644 --- a/potato_project/stacks/migrations/0001_initial.py +++ b/potato_project/stacks/migrations/0001_initial.py @@ -24,7 +24,7 @@ class Migration(migrations.Migration): ), ( "name", - models.CharField(max_length=20, null=True, verbose_name="스택명"), + models.CharField(max_length=255, null=True, verbose_name="스택명"), ), ], ),