Understanding Django internals working - Where to start? [closed] - python

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 months ago.
Improve this question
I have dabbled with Django and Created one project successfully.
What I don't understand is how exactly the whole Django Framework Works e.g. internal structure, which line of code gets executed first and why, what would be workflow between a request and response cycle, etc. ? I maybe asking the wrong questions.
What would be the best way to understand the Django framework?

I suggest you to start with a Django in depth video by James Bennett. He's member of the Django core team and was involved with it since the 2005. Video descriptions says:
This is a tutorial that goes beyond most tutorials; it's meant for
developers who already know a bit about Django and want to really
understand the inner guts of the framework. This tutorial will not
involve writing code or apps; rather, it'll be a deep tour of the
workings and APIs of Django itself, across all the bundled components
and at all levels of the stack.
I personally love this video to death, it's the starting point for my understanding of Django.

If you want to build some more advanced Django projects while being a tyro take a look at these -
http://shop.oreilly.com/product/0636920032502.do
http://shop.oreilly.com/product/9781785886775.do
If you want to read more about Django design patterns and best practices try these
https://www.twoscoopspress.com/products/two-scoops-of-django-1-8
https://highperformancedjango.com/

I assume you're wandering into Django framework territory from the neighbourhood of PHP based server-side scripts.
I too(like any newcomer...) was initially intrigued with the seemingly unnecessary abstractions around webpages, databases and business logic of the websites/web apps.
Firstly, understand that the concept of server-side web development using Django is directed by the MVC paradigm. It takes a while getting used to, but is very simple and intuitive once you get a hang of it.
Next, learn to visualize the app directory and project directory structures and the dependencies between them. For example, you should be able to understand the reason for having a separate <your_app_name> folder within every templates folder...
Finally, learning by experience and practice is a good way to learn Django basics. Jump into the simple sample implementations of Polls app to get the workflow. Finish all 7 parts of the Polls app tutorial.
Don't worry if you don't get concepts at once. Re-read them and don't forget to code as you learn.
Here's the starting point:
Django Polls app tutorial Part 1

Related

DjangoREST vs ExpressJS , which 1 should I choose to build REST API? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I want to build REST API (or GraphQL API) which I want to connect with Angular (2+) to build some nice web application.
Which framework should I choose to get started with and why? DjangoREST or ExpressJS ?
Which one of them is easier to get connected with front-end frameworks?
I know python as well as JavaScript. I also have experience with django as well as some JavaScript front-end frameworks like Angular. So, it wouldn't be that difficult to get started with nodejs or either of them.
Which of then is easier and better?
In short, Django for quick development and Express for full-stack,
scalable solutions.
Django provides better, easier security without as much experience. In the case of Express, it takes so much experience and confidence to get the same security from Node.JS
Django uses the MVT (Model View Template) design pattern and Express uses event-driven programming in which the entire architecture is driven by “events” or user choices. MVT is excellent for server-side development, on the other hand, event-driven programming is rather than separating client and server sides.
Django uses an in-house template system, so you won't hang to choosing the right one. With Express, a fully open system you may spend a lot amount of time to choose the perfect one for you.
Django is more structured to work around. It tells you how to do whereas express gives you the flexibility to do it in your way. For example, you need to use Django's ORM to interact with the database, but in the case of Express, you can choose any tool you like.
Express gives you freedom. So, if you’re experienced, there is a space to create whatever you want from scratch. Django gives you a lot of solutions with a vast template and library system, which is great for productivity but not enough for the vision.

Create an admin panel for GAE web app [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm newbie in GAE and just trying to work out basic principles of my future web app. So I looking to java to design my app. And I want realize which is better way to create admin panel? An admin should be allowed to manage posts and users for example.
I heard that Django has build-in admin panel, but I do not experienced in Python.
The great thing about going the Python/Django route is that there are great tutorials that walk you through the process step-by-step.
One example.
Google's own example of how to get Django running.
Another example, but be more careful with this one: it's slightly out-of-date. Still a good reference though.
If you're comfortable with programming, Python is a very easy language to pickup. As you mentioned, Django provides a great admin interface that does a lot of the work for you.
If you do decide to use Java, you'll have to build the admin interface from scratch, which generally takes quite a bit of time (if you want to do it right and do it well). I recommend that you use a framework to help you in the process, and here Google has some documentation on which frameworks work in GAE.

What would be the more practical uses for a Django application w/out a database? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I recently got into Django out of curiosity after developing for quite a while w/ Ruby on Rails and Node.js, and found that it's splendid for working w/ databases. Django is primarily known for working with databases and every tutorial I've ever found on it has included databases. Django supports not requiring databases however, and, just out of curiosity since I'm still rather inexperienced w/ Django, what would be some practical uses w/ Django w/out requiring databases?
I do not recommend using Django if you are not interested in using a database. Having written that disclaimer, if you insist on still using it, you can just scan over the documentation and identify what is still available to you if you do not have a database:
You can use Django's security features to help protect against clickjacking, cross site request forgeries, etc.
You can take advantage of Django's support for internationalization if you want to support multiple languages on your website.
You can have Django handle validation of any forms you have on your website.
...basically you can create a static website that takes advantage of the rapid prototyping enabled by a framework built using Python.
I can't think of many if I'm honest. If you are writing a web application that doesn't need to store to retrieve things from some sort of storage then using a whole Django project is probably total overkill.
A blog wouldn't really require a database if you only had a single user who was willing to add posts by adding files manually, but something like Jekell would be better for that.
You could create a web app that would interact with the server it's on. For example, you could create a web page that called a unix command when you hit a create webpage. You would be able to use to this create some sort of dashboard for your server or maybe provide a cleaner user interface for things that you could do with ssh. However, Django might be overkill for this, something like Flask might work better as you would have a lot less overhead.

For what purpose Django is used for? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I heard a lot of people talking about Django on various forums. But I am having a very basic question : What is meant by Framework and why Django is used.
After listening a lot about Django, I ran few chapters for Django (from Djangobook.com). After running these chapters, I am wondering how Django can be used to create a very simple website. (Website should have few pages like Home, Favorites, About, Contact linked to each other and will be providing static content).
Can Django be used for creation of such website? I searched a lot on internet but couldn't find any relevant examples, I only encountered with the examples for creation of blog, forum sites etc. If Django can be used for creation of this website, what should be the approach.
Can someone please explain this basic term "Framework" and its significance?
No. It's not for making websites. Your sample just sounds like you want plain old HTML.
Django is for creating web applications. That is, software, normally backed by a database, that includes some kind of interactivity, that operates through a browser. A Framework provides a structure and common methods for making this kind of software.
I think what you're looking for is a very simple CMS (Content Management System), there are many of those available in all kinds of languages/frameworks. Django has django-cms and mezzanine (among others).
What django is really awesome at is building dynamic websites really fast, you don't need to worry about most things, you just define your data model and off you go (almost). If you want to have a better insight into what's possible, have a look at the django tutorial (under "First Steps"), it gives you a good introduction to django and how to build websites using it.
Django can be used to create dynamic high-security web applications. For creating a static website like the one you asked, HTML is enough.
Tutorial for creating a django application can be found here.

Django or web.py, which is better to build a large website with Python? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'd like to use Python to build a website with more than 100,000 PV each day. Now what I concern is to choose which web framework. I know lots of people use Django, and some people use web.py. Django seems powerful, and I also like the simplicity of web.py. Which framework should I use? (Please introduce the performance and the maintenance complexity, thanks!) Can web.py build complicated applications? Are there other frameworks better than these two?
In case you haven't started yet, Give both frameworks a try. I started off with Django and moved to web.py.
Web.py is not that hard as one might think. In fact, I find it easier to work with than with Django!
Just my 2 cents.
EDIT: Also, this might help: http://www.aaronsw.com/weblog/rewritingreddit
Django makes building complicated sites really simple. Before Django, I was messing around with PHP, and I was doing a really terrible job putting it together. Django leads you in the right direction with some good practices which makes your site really easy to maintain and update. I really like the ORM and how you can easily work with data from the database without having to write a single line of SQL. It makes development less of a slog.
I don't have any experience with web.py, and I can't compare the performance of the two. But you can't go wrong with Django at least.
Django is actually quite fast. Using caches and multiple DB backends is a doodle - you actually can utilize Django's predefined caching framework for one-line view caching or even template fragment caching. And of course - low-level cache API. And - it's fun!
In my experience - deployed under nginx and uWSGI, watched over by Supervisord, with the recently hot Celery task queueing package – Django is blazingly fast, easy to scale and configure and very reliable.
forget all those, if you want a beautiful framework look for weppy, i have used django , web2py, bottle,flask and most major php frameworks, just use weppy its full stack and exquisitely elegant, for php i simply created my own microframework that looks abit like weppy but its not fullstack, i love the granular control that weppy gives me and its quite easy to learn and its such a joy to use, eer did i already say that its beautiful? yes it surely is hahaha. you can find it here : http://www.weppy.org thank me later

Categories

Resources