How to create a basic website with Python on Django

  • Published on
    06-May-2015

  • View
    783

  • Download
    1

Embed Size (px)

Transcript

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