HOW TO CREATE A
BASIC WEBSITE
WITH PYTHON ON
DJANGO
Python?
That was a joke!
Ideology behind name:
A television series
Monty Python's Flying Circus
Python;
 Open source
 Interpreted
 Interactive
 Object Oriented
 Clear syntax
 High-level programming language
 Bat...
Django?
 High-level Python Web Framework
 MTV instead of MVC
 Built-in ORM (Object –relational Mapper)
 Simple but powerful UR...
No more
spaghetti code!
Python
(http://python.org/download/)
pip
(https://pypi.python.org/pypi/pip)
Let’s start to work
First;
 $pip install virtualenv
 virtualenv devfestwoman
 Activate virtual environment
 $pip freez...
 Creating a project
$django-admin.py startproject devfestwoman
 Let’s look at what startproject created:
devfestwoman/
m...
$python manage.py runserver
Browse http://127.0.0.1:8000
Now, shoot a glance
to devfestwoman/settings.py
We need to create the tables in the
database before we can use them
$python manage.py syncdb
Working with applications
$python manage.py startapp
core
Let’s look at what startapp
created:
 core/
__init__.py
admin.py
models.py
tests.py
views.py
Creating models
add the app to settings.py
$python manage.py syncdb
Enter the admin site
 Browse localhost:8000/admin
 Register your models on admin.py
Write the first view
 declare a URLconf
 Write your view
Showing your data
 First, create a directory called templates in
your core directory and write your first template.
$python manage.py runserver
Browse http://127.0.0.1:8000
Thank you for your attendance
Me on web
 Linkedin
http://www.linkedin.com/profile/view?id=175690905&
trk=nav_responsive_tab_profile
 Github
https://gi...
How to create a basic website with Python on Django
How to create a basic website with Python on Django
How to create a basic website with Python on Django
How to create a basic website with Python on Django
Upcoming SlideShare
Loading in …5
×

How to create a basic website with Python on Django

1,185 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,185
On SlideShare
0
From Embeds
0
Number of Embeds
32
Actions
Shares
0
Downloads
49
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

How to create a basic website with Python on Django

  1. 1. HOW TO CREATE A BASIC WEBSITE WITH PYTHON ON DJANGO
  2. 2. Python?
  3. 3. That was a joke!
  4. 4. Ideology behind name: A television series Monty Python's Flying Circus
  5. 5. Python;  Open source  Interpreted  Interactive  Object Oriented  Clear syntax  High-level programming language  Batteries included
  6. 6. Django?
  7. 7.  High-level Python Web Framework  MTV instead of MVC  Built-in ORM (Object –relational Mapper)  Simple but powerful URL Patterns  Built-in Authentication System  Automatic Admin Interface
  8. 8. No more spaghetti code!
  9. 9. Python (http://python.org/download/) pip (https://pypi.python.org/pypi/pip)
  10. 10. Let’s start to work First;  $pip install virtualenv  virtualenv devfestwoman  Activate virtual environment  $pip freeze  $pip install Django
  11. 11.  Creating a project $django-admin.py startproject devfestwoman  Let’s look at what startproject created: devfestwoman/ manage.py devfestwoman/ __init__.py settings.py urls.py wsgi.py
  12. 12. $python manage.py runserver Browse http://127.0.0.1:8000
  13. 13. Now, shoot a glance to devfestwoman/settings.py
  14. 14. We need to create the tables in the database before we can use them $python manage.py syncdb
  15. 15. Working with applications $python manage.py startapp core
  16. 16. Let’s look at what startapp created:  core/ __init__.py admin.py models.py tests.py views.py
  17. 17. Creating models
  18. 18. add the app to settings.py $python manage.py syncdb
  19. 19. Enter the admin site  Browse localhost:8000/admin  Register your models on admin.py
  20. 20. Write the first view  declare a URLconf  Write your view
  21. 21. Showing your data  First, create a directory called templates in your core directory and write your first template.
  22. 22. $python manage.py runserver Browse http://127.0.0.1:8000
  23. 23. Thank you for your attendance
  24. 24. Me on web  Linkedin http://www.linkedin.com/profile/view?id=175690905& trk=nav_responsive_tab_profile  Github https://github.com/broccolinisoup Armağan Ersöz 03.05.2014

×