100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
PYTHON DJANGO EXAM WITH QUESTIONS AND ANSWERS $13.99   Add to cart

Exam (elaborations)

PYTHON DJANGO EXAM WITH QUESTIONS AND ANSWERS

 6 views  0 purchase
  • Course
  • PYTHON DJANGO
  • Institution
  • PYTHON DJANGO

PYTHON DJANGO EXAM WITH QUESTIONS AND ANSWERS...

Preview 2 out of 14  pages

  • July 26, 2024
  • 14
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
  • PYTHON DJANGO
  • PYTHON DJANGO
avatar-seller
luzlinkuz
PYTHON DJANGO EXAM WITH QUESTIONS AND ANSWERS Describe the major actions that occur after the user enters a URL that refers to a site managed by Django. - ANSWER On the client side, the browser will use DNS to get the IP address corresponding to the URL, use this address to commun icate with the server (via HTTP running over TCP/ip), send the HTTP (GET) request to the server. The web server will have been configured to hand the URL to the Django site, at which point it uses the info in urls.py (as describe d above). This process maps the URL request to a view function (or class); the view code typical ly uses models to interact with a database and apply business logic to the data. The data is then handed to an HTML template(s) for rendering, which results in HTML, etc. being returned to the browser. What is the difference between a project and an app, and why does Django have both? - ANSWER A project is the entire application as a whole, and the app refers to a submodule of the project. Apps are not related to other apps in the project a nd in theory, can be copy-pasted to another project and still work without modifications. In general, how does the DRY Principle apply to software development? (note : this is not just a Python/Django thing). What problems can arise from not foll owing DRY principles? - ANSWER DRY is the "don't repeat yourself" principle and means that repetition of information should be avoided. This is applied t o software development by splicing code into reusable, smaller sections, so the same code/information is not duplicated in other areas. If the DRY principle is not followed, then code can become more difficult to manage. For example, when logi c changes need to be made, instead of changing them in one location the changes would have to be made in every place that uses that logic. Describe/Explain one example of where the DRY principle is applied in the design of Django. - ANSWER Model code is used to generate ORM (object-relational-mapping) interface to the DB. This keeps you from havi ng to keep SQL queries in sync with changes to the class's data. The data is reflected in only one place (the model), versus in both a class declaration and sql statemen ts. The model is used to generate default forms/templates that correspond to the model data (again, versus maintaining all forms separately and keeping them in sync with data in classes). What exactly is a "migration"? - ANSWER Migrations are Django's ways to send changes in your models to the database. It's basically just waiting to se nd SQL that was already written to the database until you tell it to. It is easy to use SQL to just drop tables and then re-run a sql script to create the new tables that I want, so why are migrations useful? - ANSWER Migrations allows you to map your SQL perfectly to your Models and OOP specifically. Migrations also guarantee you don't repeat yourself, and that a bunch o f database changes you make at a time work when you send them all to the database together. It reduces error, as it automatically helps with stuff like foreign keys and other more complicated changes. path('<int:question_id>/', views.detail, name='detail' ), Is question_id a "keyword"? What does this notation have to match up with? - ANSWER In this case, question_id is sent to the view function as a k eyword argument where the detail view must take a variable named 'question_id' as an argument. a. What does the {{ .... }} syntax mean? - ANSWER Will render variables that are within the current context of the template. b. What does the {% .... %} syntax mean? - ANSWER Code within will be interpreted as python What are the main steps required to start a Django project? - ANSWER Install Virtual Environment (Optional) Create the virtual environment directory (python -m venv folder-name) Activate the virtual environment (folder-name\Scripts\activate.bat) Install Django using pip (pip install django)

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller luzlinkuz. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $13.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

72042 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$13.99
  • (0)
  Add to cart