Django experience to get started, contrast Asp.Net Core Framework

Foreword

Recently often hear "Life is short, I chose python" This sentence, of curiosity, the author of python web framework and related technologies to do some research herein, this masterpiece on the right python web framework Django web framework and the main Microsoft Asp. Net Core make some introductory remarks and contrast.

What is Django

Django is a web framework using python language developed primarily for web site background and Api development. Due to the characteristics of simple python language, using the Django framework to develop the site is very easy to do, many of the development style and Node Js acquaintance, is second only to Spring boot, the popular back-end framework NodeJs. Django appears it has been more than a decade, but the real popular Python or rely on the rapid rise in recent years.

What is Asp.Net Core

Asp.Net Core is supported by Microsoft and developed a web framework, mainly used for website background and large enterprise back-office systems development. Asp.Net Core based on C # development, its greatest feature is the elegant syntax, object-oriented, security, etc., in response to complex business and high-performance system has a strong advantage. Asp.Net Core was born only a few years, but her "previous life" is the Asp.Net Framework, used Windows knows all the people who believe. With strong support of Microsoft's Azure and east, Asp.Net Core back-end framework in the market is also very popular.

How to use Django

Django After ten years of development, their communities and the tools and libraries have been perfect, create a Django framework can be just a few lines cli.

Create a Django

Step1: installing python

In the python official website to install the latest version of choice: https://www.python.org/

After the installation is completed to see if the installation was successful in cmd:

python --version

Successful installation enter the following:

Python 3.8.0

Step2: Installation Virtualenv:

We need to use pip (Python package tool) to install virtualenv

Enter the following command in cmd:

pip install virtualenv

All installation so far is the system level, all of the following installation includes Django will be in a virtual environment.

Step3: Django installed in a virtual environment

Create a file folder to install Django:

mkdir myproject
cd myproject

Create a virtual environment in myproject folder and activate:

virtualenv venv
venv\Scripts\activate

Django is installed in a virtual environment:

pip install django

 Installation of a new single Django project:

django-admin startproject myproject

After installing the program is structured as follows:

 Start Django project:

python manage.py runserver

 Here Django project is to create a complete view of the relevant Django, model and routing behind the operation was described in detail.

How to use Asp.Net Core

Asp.Net Core birth, though not long, but she inherits almost all the advantages of Asp.Net: simple, fast, secure, powerful IDE support. If you have used .net or Visual Studio, then build a Asp.Net Core project will be very easy.

Creating Asp.Net Core

Step1: Installation .net core

Select the latest .net core SDK installation in Microsoft's official website: https://dotnet.microsoft.com/download

cli see if the installation was successful:

dotnet --version

 Step2: install Visual Studio2019

Select the latest Visual Studio installed Microsoft's official website: https://visualstudio.microsoft.com/zh-hans/vs/

Step3: create a new Asp.Net Core Applications

Open Visual Studio choose to create a new project:

 Select Asp.Net Core Web application and create

 Visual Studio provides many options for us, here select the Web application:

 Once created the project is structured as follows:

 In Visual Studio, press Ctrl + F5 to start Asp.Net Core Project:

Visit https: // localhost: 5001 /

 SSL Certificate Visual Studio has been automatically added, you can use https access.

These are then be introduced later Asp.Net Core project creation process, related Asp.Net Core of view, models, routing, REST Api, architecture and so on.

Django和Asp.Net Core

As a back-end framework, Django and Asp.Net Core both have their own advantages, the following are brief Django and Asp.Net Core advantages.

Django advantage

  • Based on Python, Django Python-based development, the inheritors of all the features of Python, python as the biggest advantage of dynamic scripting language syntax is simple, quick start, if learned JavaScript or C #, Java and other languages, it will be very easy to get started python.
  • Rich code base, currently has hundreds of thousands python bag as much as possible you want to achieve in these packages have been better realized.
  • Wide popular use, manufacturers are using Django representatives Instagram , watercress, know almost so on.

Asp.Net Core Advantage

  •  Based on C #, Asp.Net Core based on C #, with all the advantages of C #, c #, as with OOP, security, syntax, known for elegant language loved by many developers. C # is simple and elegant, for which Microsoft provided a very comprehensive document for developers to learn, if you will want to learn C # is a very easy thing.
  • Powerful rich standard library, as opposed to Django, Asp.Net Core community code base is not rich, but the standard libraries provided by Microsoft is very strong, in most cases does not require code library community, which is the code base is not rich one of the reasons.
  • Microsoft, Azure strong support, if you need a cross-platform applications on Azure, Asp.Net Core will be the best choice.
  • Powerful IDE, Visual Studio IDE has been the most powerful cosmic known for its strong, smart has been well received by developers alike. Visual Studio provides powerful code hinting, abnormal warning, debugging and other functions, as people are often unable to stop using once, if you want to improve efficiency, saving development time Visual Studio is the best choice.

how to choose

The above introduced the Django and Asp.Net Core advantage, but two web frameworks seem difficult to choose is different, where the author of their own learning experience and summary to give you some suggestions, hope that we can make the most appropriate choice.

language selection

 Not the best language, only the most appropriate language. Many people tend to exist on the portal language selection bias, the Internet often hear "a certain language is the best in the world", in fact design language of the beginning is not to defeat the other languages, but for the most suitable for a particular scene, Javascript is the most suitable example web front end, c and so most suitable for the underlying computer. Therefore, we must combine technology selection at the time of the company's business development direction and order, if the company's main business is artificial intelligence, data mining, machine learning, then python is certainly the most appropriate choice, if the company needs is security and stability the back-office services, micro-services, business systems, cloud-based, so Asp.Net Core would be more appropriate.

python has been the artificial intelligence, machine learning, data mining is an outstanding representative, c # is the most important feature of OOP, safe, so the background in business, the server has a great advantage.

Select the frame

In the framework of today's popular, we often do not need to select a tangle of language, because most of the current framework is REST style, so in a high-end system has never been more than one language, a framework. For the vast majority of SMEs, choose a frame is enough, both are free open source framework, there is no need for the issue of fees tangle. Django code base is rich, but the standard library is far from enough, many of the features are from third-party code libraries, code libraries might charge, may free, may be efficient, it may be inefficient, so I chose Django often entangled in third-party libraries s Choice. If the portal site, blog site class, fast on-line system, using the Django development will be more effective. Asp.Net Core standard library is very powerful and safe, for the enterprise back-office systems, platform systems, cloud systems, service is very suitable for micro, c # syntax linq, lamdba, Task, async, await other characteristics can calmly deal with complex business and high-performance systems. DDD architecture built using Asp.Net Core applications can easily split, decoupling business, for large business systems such as: ERP, CRM, WMS, etc. is not only more efficient, more flexible control can build a business platform-level products.

to sum up

This article describes how to use Django and Asp.Net Core and selection, the above comparison and selection recommendations are summarized my experience and learning, please also indicate if insufficient. Sword quoted words, "not seek Jesus Christ who seek temporary shortage; do not seek a global, less than seek a field" for enterprises to want to make the most appropriate choice, not only for the business to be very sophisticated, but also have enough technology awareness.

Guess you like

Origin www.cnblogs.com/william-xu/p/11806804.html