Django Nedir, Neden PyCharm?
Django, Python ile yazılmış olgun, "batteries-included" bir web framework'üdür. Admin paneli, ORM, authentication, migration sistemi, template engine, form yönetimi gibi web uygulaması için gereken her şeyi içerir. PyCharm (JetBrains tarafından geliştirilen Python IDE), Django ile en iyi entegrasyona sahip ortamdır: otomatik tamamlama, debug, migration yardımcıları, template engine syntax desteği.Bu rehber yeni başlayanlar için PyCharm'a Django kurulumunu sıfırdan anlatır. AIOR olarak Python tabanlı projeler geliştirirken PyCharm Professional sürümünü tercih ediyoruz.
Ön Gereksinimler
- Python 3.10+ kurulu olmalı (python --version ile doğrulayın)- PyCharm Community veya Professional sürümü kurulu olmalı (Community ücretsiz ama Django tooling sınırlı; Professional 30 günlük deneme veya öğrenci lisansı ile alınabilir)
- Komut satırına erişim
Adım 1 — Virtual Environment Oluşturma
PyCharm'da File → New Project menüsünden yeni bir proje oluşturun. "Pure Python" şablonunu seçin. "Python Interpreter" bölümünde New environment using Virtualenv seçili olduğundan emin olun; bu izole bir Python ortamı oluşturur ve global sistem kütüphaneleriyle çakışmayı engeller.Lokasyon: /Users/me/Projects/django-app gibi anlamlı bir yol seçin. PyCharm otomatik olarak .venv klasörünü oluşturur.
Adım 2 — Django Kurulumu (Terminal İçinde)
PyCharm'da Terminal sekmesini açın (View → Tool Windows → Terminal). Virtual env aktif olmalı — promptun başında (.venv) görmelisiniz. Django'yu pip ile kurun:
Code:
pip install django
En son LTS sürümünü kurar. Spesifik bir sürüm gerekiyorsa:
Code:
pip install django==4.2
Doğrulama:
Code:
django-admin --version
Adım 3 — Django Projesi Oluşturma
Aynı terminalde:
Code:
django-admin startproject mysite .
Sondaki nokta projeyi mevcut dizinde oluşturur (alt dizin yaratmaz). Üretilen dosyalar:
manage.py — Django CLI komutları
mysite/settings.py — yapılandırma
mysite/urls.py — URL routing
mysite/wsgi.py — production deployment
Adım 4 — Geliştirme Sunucusunu Çalıştırma
Yine terminalde:
Code:
python manage.py runserver
Çıktıda Starting development server at http://127.0.0.1:8000/ gördüğünüzde tarayıcıdan ziyaret edin. Django'nun "The install worked successfully!" sayfası karşınıza çıkmalı.
Adım 5 — İlk App Oluşturma
Django projeleri "app" denilen modüllerden oluşur:
Code:
python manage.py startapp blog
blog dizini oluşur, içinde models.py, views.py, admin.py, apps.py dosyaları yer alır. Bu app'i mysite/settings.py içindeki INSTALLED_APPS listesine eklemeyi unutmayın:
Code:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog', # ← yeni eklenen
]
Adım 6 — Migration Sistemi
Django'nun database migration sistemi şemayı kod üzerinden yönetir:
Code:
python manage.py migrate
Bu komut Django'nun yerleşik tabloları (auth, admin, sessions) için SQL çalıştırır. Yeni model eklediğinizde:
Code:
python manage.py makemigrations
python manage.py migrate
Adım 7 — Admin Paneli ve Superuser
Code:
python manage.py createsuperuser
Username, e-mail, şifre soracaktır. Sonra http://127.0.0.1:8000/admin/ adresinden Django'nun otomatik admin paneline giriş yapabilirsiniz.
PyCharm Spesifik Avantajlar
PyCharm Professional'da Django desteği şu özellikleri sağlar:- Template syntax highlighting: {% if %} {% endfor %} {{ variable }} otomatik renklenir
- URL completion: reverse() ve {% url %} tag'ında URL ismi otomatik tamamlanır
- Model field types: CharField, IntegerField gibi alanların tipleri IDE tarafından bilinir
- Manage.py task runner: makemigrations, runserver gibi komutları GUI butonlarla çalıştırın
Üretim Hazırlığı
Geliştirme tamamlandığında PostgreSQL'e geçiş, DEBUG=False, ALLOWED_HOSTS doldurma ve collectstatic gibi adımlar gereklidir. AIOR hosting paketlerimizde Django uygulamaları için PostgreSQL, Redis ve nginx + gunicorn ön-konfigüre olarak gelir; deployment süreciniz dakikalara iner.What Is Django, Why PyCharm?
Django is a mature, "batteries-included" Python web framework. It ships with everything a web app needs: admin panel, ORM, authentication, migration system, template engine, form handling. PyCharm (JetBrains' Python IDE) has the best Django integration available: auto-completion, debugging, migration helpers, template syntax support.This guide takes a beginner through installing Django in PyCharm from scratch. At AIOR we use PyCharm Professional for our Python-based projects.
Prerequisites
- Python 3.10+ installed (verify with python --version)- PyCharm Community or Professional installed (Community is free but Django tooling is limited; Professional offers a 30-day trial or student licensing)
- Command-line access
Step 1 — Create a Virtual Environment
In PyCharm choose File → New Project. Pick the "Pure Python" template. Under "Python Interpreter", confirm New environment using Virtualenv is selected — this creates an isolated Python environment so global packages don't conflict with your project.Location: choose a meaningful path like /Users/me/Projects/django-app. PyCharm creates the .venv folder automatically.
Step 2 — Install Django (in the Terminal)
Open the Terminal tab in PyCharm (View → Tool Windows → Terminal). The virtual env should be active — the prompt should show (.venv). Install Django with pip:
Code:
pip install django
This installs the latest LTS. To pin a specific version:
Code:
pip install django==4.2
Verify:
Code:
django-admin --version
Step 3 — Create the Django Project
In the same terminal:
Code:
django-admin startproject mysite .
The trailing dot creates the project in the current directory (no extra subfolder). Files generated:
manage.py — Django CLI commands
mysite/settings.py — configuration
mysite/urls.py — URL routing
mysite/wsgi.py — production deployment
Step 4 — Run the Development Server
In the terminal:
Code:
python manage.py runserver
When you see Starting development server at http://127.0.0.1:8000/, open it in your browser. Django's "The install worked successfully!" page should appear.
Step 5 — Create Your First App
Django projects are composed of "apps" (modules):
Code:
python manage.py startapp blog
A blog directory appears with models.py, views.py, admin.py, apps.py. Don't forget to add the app to INSTALLED_APPS in mysite/settings.py:
Code:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog', # ← newly added
]
Step 6 — The Migration System
Django's migration system manages schema through code:
Code:
python manage.py migrate
This runs the SQL for Django's built-in tables (auth, admin, sessions). When you add a new model:
Code:
python manage.py makemigrations
python manage.py migrate
Step 7 — Admin Panel and Superuser
Code:
python manage.py createsuperuser
It asks for username, email and password. Then visit http://127.0.0.1:8000/admin/ to log into Django's auto-generated admin panel.
PyCharm-Specific Advantages
PyCharm Professional's Django support gives you:- Template syntax highlighting: {% if %} {% endfor %} {{ variable }} colour automatically
- URL completion: reverse() and {% url %} tag get URL name auto-completion
- Model field types: the IDE understands CharField, IntegerField etc.
- Manage.py task runner: run makemigrations, runserver etc. via GUI buttons