How do I read JSON in Python?
Use json.loads for a string or json.load for an open file. Handle JSONDecodeError if the input may be malformed.
What does a with statement do in Python?
It runs setup and cleanup around a block. When opening a file, it closes the file even if reading fails.
What is a Python list comprehension?
It builds a list from an iterable, optionally filtering items. Use a regular loop if the transformation has several steps.
What is a Django form used for?
A form parses and validates submitted values. Check is_valid before reading cleaned_data.
What does a Django migration record?
It records a schema change or a data operation so the project can apply that change consistently to each database.
What is CSRF protection in Django?
It helps prevent another site from making unwanted state-changing requests with a user’s session. Include Django’s token in your own HTML POST forms.
What is the difference between GET and POST in a web form?
GET is intended to retrieve information and typically places form values in the URL. Use POST for actions that change server state, such as creating a task.
Why should server code validate data from React?
Browser checks can be bypassed. Validate types, ranges and permissions on the server before writing to the database.
How do I test a Django form with invalid data?
Submit a payload with a missing or invalid field and assert that the form reports an error and creates no record.
What belongs in a Python web project README?
Include prerequisites, environment setup, how to run migrations and tests, and one example that shows what the app does.
See the beginner Q&A guide for related topics.