This article walks you through the steps of a beginner developing a coupon distribution service for the iPhone with a RESTful API and swift. It is a very detour implementation because it was implemented while examining the technical elements one by one.
For those who are new to programming as well as Python, programming based on modern fremework may be frustrating just by building an environment. So for the time being, I will introduce a method that makes it easy to experience writing and running a program. We're dealing with Python here. The computer is assumed to be a Mac.
As a working folder, create a folder for saving programs under your home directory (user name folder). I created a folder to be my home directory / workspace / python-sample. We recommend that you use English characters for the folder name.
For Mac, Python is installed from the beginning (as of Mac OS 10.15). The version is a little old, but there is no problem as long as it runs a basic program. Just in case, make sure that it is really installed.
If you are using a Mac, you can easily check it at the terminal. Terminal is a tool that corresponds to the command prompt in Windows. The terminal is usually stored in the application / utility.
Open a terminal and enter the following command to execute (press the Enter key). (The $ mark is displayed from the beginning, so do not enter it.)
$ Python -V
If you see the Python version, you already have Python installed.
If the editor is Mac, you can use TextEdit and so on. If you are thinking of writing Python in earnest, it is convenient to install Visual Studio Code etc. is. It is available free of charge. Installation can be done in the same way as a normal application.
Now, let's write a program that displays standard characters.
print('Hello Python')
It's a simple one-line program. After writing, save it in the file created earlier, but there are two points to note at this time.
Open a terminal and navigate to the folder where you saved the program. The command when moving is
$cd folder path
It will be. (The $ mark is displayed from the beginning, so do not enter it.)
For example, if you save the program in your home directory (user name folder) / workspace / python-sample, the location when you open the terminal will automatically be your home directory.
$ cd workspace/python-sample
It will be. "Cd" is a command used to move folders and is an abbreviation for change directory. When moving to the next higher folder
cd ../
Enter.
After moving to the folder where you saved the program, you can execute the program with the following command.
python filename.py
When executed, the result will be displayed in the terminal. The keyword "Hello Python" written in the program is displayed. (Hereafter, execution result)
With this flow, you can try Python programming like a sandbox even if you don't have a solid development environment.
Next, Create a virtual environment for pipenv and install Django
Recommended Posts