Django project learning summary
January 26, 2020 by admin
Django is a framework, when used together with a UI framework such as Bootstrap can speed up the construction of a webapp to within 1 week or so. Its structure is clear and scalable and once familiarized with the advantages are quite obvious because it does a lot of the typical web-app work for the developer.
Some take-aways from my first attempt using Django: steep learning curve - give a few weeks to familiarize with any new framework.
DB
- Try to use the same database during development and deployment that way you won’t have extra issues to deal with when you’re deploying like connector issues or version compatibility issues
- Be careful changing database models because if it doesn’t work with your existing database the migrate might create issues.
- Learn about more DB stuff in your spare time
CSS
- When trying to hide something, hide the larger enclosing HTML element, this not only makes the CSS more efficient, readable, but also makes the display of the inner part easier as sometimes they don't have to be hidden separately.
- Use buttons when submitting a form
- Some of the elements already come pre-styled so sometimes they need to overwritten
- E.g. links are blue and underlined on hover, when clicked they’re purple
- E.g. buttons have a border and background color and padding
Design
- When making a feature, think about usability before styling anything because it might need to change
- Think about user experience
- What if they want to undo the change?
- What if they forget their password
- What if they misclick?
- Think about different screen sizes and how to make it work for each of them. The HTML needs to be adaptable to other screens and Django doesn’t have ability to detect screen sizes.
- In daily life, look at designs that work well and crop them and save them so when designing these can be a portfolio of ideas
- Different states of the application needs to be considered
- Logo placement
- Certain icon placements only look good on certain places
Debug
- The CSS - use outline: 1px solid black and background-color: red to see the element, use the developer console to hover on the element of interest
- JS: use the developer console in FF and Chrome alert() and console.log()to see the errors and where the code execution failed
- Django python print()
- DB errors - mostly compatibility and migration issues. These can be fixed quickly by deleting the database but in practice it's probably best to not change any attributes related to keys because that causes most of the issues.