[PYTHON] What non-programmers and web app development beginners should do to clear GeoDjango tutorials at explosive speed

This is the 24th day article of FOSS4G Advent Calendar 2019.

Introduction (Conclusion)

What non-programmers and web application development beginners should do to clear the GeoDjango tutorial (Geospatial information starting with GeoDjango)
  1. Recognize that web application development is cumulative learning.
  2. Go around the DjangoGirls Tutorial to get an overview of website construction and Django.
  3. Make a Location-Based Web App With Django and GeoDjango Learn how to use PostgreSQL with DOCKER. The difficulty level is low because you are not required to implement the RESTful API.
  4. GeoDjango Tutorial: Geospatial information starting with GeoDjango is advanced at explosive speed while reading this article.

Introduction (introduction)

There are many technical blogs with titles such as "Beginners" and "Introduction", but I often feel that many of them are written for "people who know to some extent". It's like a person who knows the technology organizes and writes information as a review, but there are also articles that are exhausted on the way and memos that you should know yourself. I think it is unavoidable that people who do not understand can not understand "I do not understand", but even in articles assuming beginners, "naturally as an engineer" and "settings necessary to use the system" are clearly stated. I often don't mention it, and for beginners, there are many situations where ** "I can't do what I was told !!!!" **.

My main job is a non-programmer of a construction consultant, and I was omitted from the ability to read this omitted branch before me, who was a ** web-related complete beginner ** who came up with the idea of "I want to make an app using GeoDjango". The ability to carry out work stood out as a high wall.

Purpose

Based on such experience, this article aims to provide supplementary teaching materials for GeoDjango tutorials for web application development beginners and non-programmers.

Tutorial to work on

Geospatial information starting with GeoDjango (by Hiroshi Omata)

Development environment

macOS version 10.15.1

Practice! !!

0. Be prepared for programming

I don't think it's a "natural" attitude for programmers, and I don't have the opportunity to see it as unexpectedly organized information, and it's not familiar to non-programmers. Here are some of the attitudes I was grateful for being taught by an acquaintance of the programmer.

** _ "See the official documentation as well as the technical blog" _ ** Learning a computer language is equivalent to learning a new language, and it is important to have a solid understanding of grammar. It is very important to have time to go back to the basics and read the official documentation. ** _ "Read the Error statement properly before searching" _ ** I got an error and it became "bubbly", and I asked the Google teacher without reading the error sentence, which wasted time. In Python, the cause of the error is properly written at the end of the error statement. Calm down and read the Error statement. ** _ "Most of the problems you hit are problems that someone has already hit" _ ** If you have a problem, before asking someone, look for someone who is having the same problem on various technical blogs such as Qiita or StackOverFlow. There are overwhelmingly more English sources than Japanese sources, and boldly challenging English is a shortcut to solving problems. ** _ "It is justice that the script works. It is justice that it can serve its purpose." _ ** When reading a CSV file as a dataframe, I knew that using pandas would do it in an instant, but there was a time when I was trying and erroring if I could do something with numpy's np.loadtxt. As for my feelings, I was suffering from the "illness I want to do after finishing everything" that is common to beginners who say "I can't do it because I don't understand numpy, I have to master it properly." When I consulted with my friend's programmer, I was dismissed as saying, "Prioritize that purpose. It's a waste of time, so pandas is fine." We are not in the test. There is smart code, but there is no right answer, and you should not misunderstand the top priority of "fulfilling the purpose you are trying to achieve."

1. Pre-learning

1-1. Learn the basics of Django

The original Django Tutorial is difficult for beginners, so [Django Girls Tutorial](https://tutorial. Learn the basics of Django at djangogirls.org/en/ "DjangoGirlsTutrial"). It covers the minimum necessary command line operations, HTML, CSS, and Python basic grammar required for Django operations, so you don't need to learn elemental techniques individually. However, since it is the minimum necessary, the study method when you want to deepen these elemental technologies individually is summarized in [Bottom](Basic knowledge about #web and acquisition of basic python grammar).

While there are multiple files that affect each other in a directory with multiple layers, what kind of flow is the data processed, in what order should the files be edited, ... At first, it is confusing. I was doing

"If you add one more Template page, Add that the number of pages has increased in urls, Add that the number of pages has increased in View It is necessary. " Source: [[Python / Django] 6 Tips for Using Web Frameworks-To Create Apps in the Shortest Distance [For Beginners]](http://coinbaby8.com/python-django-framework-6-idea.html // "Monpro programming for problem finding and solving")

Understanding has progressed since I became aware of the flow of some "one set".

1-2. Learn how to operate PostgreSQL using DOCKER

The DjangoGirls Tutorial (https://tutorial.djangogirls.org/en/ "DjangoGirlsTutrial") uses the default database (SQLite), but GeoDjango needs to change this to PostgreSQL. In Geospatial Information Starting with GeoDjango, use the $ createdb command to postGIS, which is a PostgreSQL location extension. I'm creating a database of, but if that doesn't work I need to use DOCKER. Creating and launching a database using DOCKER is [Make a Location-Based Web App With Django and GeoDjango](https://realpython.com/location-based-app-with-geodjango-tutorial/ "Make a Location-Based" It's detailed (in English) in the Web App With Django and GeoDjango "). On the contrary, the installation method using Homebrew of four peripheral tools (GDAL, GEOS, PROJ4, PostgresSQL) required for GeoDjango is not introduced on this site, so [Geospatial information starting with GeoDjango: Preparatory installation]( You need to refer to https://homata.gitbook.io/geodjango/qian-zhun-bei/install#mac-osx-1 / "Mac (OSX)") to install Homebrew and install the tools. It is the installation of Xcode required when installing Homebrew, but since a problem occurred in the installation from the App store, [this article](https://qiita.com/NolikaOhkawa/items/1bc2960f513d3d6a8882 / "Install Xcode on Mac" I installed it directly from the .dmg file, referring to ").

2. GeoDjango tutorial

With this solid pre-learning, you should be able to clear the GeoDjango tutorial: Geospatial Information Beginning with GeoDjango at explosive speed.

As I proceeded with the tutorial while referring to multiple sites, I was often confused by the difference in code notation. The notation differs depending on the person / site,

python


Which one shows the memo
(env) $Which one shows the description in the terminal
Which one shows the execution result on the terminal

What part is the editor
Does it indicate a script to edit?

It took me some time to understand. For example, the code shown in "Creating a RESTful API" (https://homata.gitbook.io/geodjango/geodjango/tutorial#restful-apino/ "GeoDjango Tutorial: Creating a RESTful API") If (env) $ comes to the beginning of the sentence, you can tell that it is written in terminal, but you need to read the context whether the ground part is the execution result of terminal or the code in the file. This area is "natural for those who understand", but I think it will take some time for beginners to get used to it. Image 24-12-19 at 2.52 am.JPG Image 24-12-19 at 2.56 am.JPG

Summary

In order to develop apps at explosive speed, it became a punch line without a lid that accumulated learning to acquire knowledge is indispensable. In this learning, it is important to have someone who can learn and consult with someone again, having the experience that it is difficult to find resources that can reach the itch and many of the clues to the solution came from the human mouth. I realized that.

Supplementary information

Acquisition of basic knowledge about WEB and basic grammar of Python

To work with Django, you need to have a basic knowledge of website construction, and you need to know the basic grammar of Python, so beginners should take the following materials one by one. You don't have to spend many laps to learn the concept, as long as you can understand it. __ 1000 yen per month Let's concentrate and finish in a short period of time after paying a little. __ Commercially available texts may be used, but I personally recommend Dot Install Progate. There is also the fact that I used this, but the main reason is that I think that these two sites are conscientious learning support services that do not advertise using words such as "change of job" and "employment". is.

For dot installation

Introduction to UNIX Commands → [Building HTML / CSS Development Environment](https://dotinstall.com/lessons/ basic_pcsetup_mac_v2 / "Prepare the HTML / CSS learning environment [macOS]") → Introduction to HTML → [Introduction to CSS](https:: //dotinstall.com/lessons/basic_css_v5/ "First CSS") → Introduction to Python 3

For Progate

Command Line Basics → [HTML & CSS](https://prog-8.com/languages/ html / "HTML & CSS Languages for creating the appearance of Web pages") (Beginner / Intermediate is enough) → Introduction to Python

Recommended Posts

What non-programmers and web app development beginners should do to clear GeoDjango tutorials at explosive speed
Instantly convert Model to Dictionary with Django and initialize Form at explosive speed