- Python Programming Blueprints
- Daniel Furtado Marcus Pennington
- 330字
- 2021-06-24 18:53:51
Setting up the environment
The first thing we have to do is, as usual, set up our development environment and the first step is to create a virtual environment for our application. Our application will be called twittervotes, so let's go ahead and create a virtual environment called twittervotes:

When the virtualenv environment has been created, you can activate it with the following command:
. twittervotes/bin/activate
Great! Now let's set up the project's directory structure. It should look like the following:
twittervotes
├── core
│ ├── models
└── templates
Let's dive into the structure a bit:

Next, it is time to add our project's dependencies. Go ahead and create a file called requirements.txt in the twittervotes directory with the following content:
Flask==0.12.2
oauth2==1.9.0.post1
PyYAML==3.12
requests==2.18.4
Rx==1.6.0
The following table explains what the preceding dependencies mean:

When the file has been created, run the command pip install -r requirements.txt, and you should see an output similar to the following:

Now that our environment is set up, we can start creating our Twitter application. As usual, before you start coding, make sure that you have your code under a source control system such as Git; there are plenty of online services that will host your repositories for free.
In this way, you can roll back different versions of your projects and you don't have the risk of losing your work if you have problems with your computers. With that said, let's create our Twitter application.
- 物聯網與北斗應用
- Modern JavaScript Web Development Cookbook
- 物聯網(IoT)基礎:網絡技術+協議+用例
- Spring Boot 2.0 Projects
- OpenLayers Cookbook
- Web Application Development with R Using Shiny
- 正在爆發的互聯網革命
- 互聯網安全的40個智慧洞見:2014年中國互聯網安全大會文集
- 網絡的琴弦:玩轉IP看監控
- 中小型局域網組建、管理與維護實戰
- 區塊鏈輕松上手:原理、源碼、搭建與應用
- 智慧光網絡:關鍵技術、應用實踐和未來演進
- Kong網關:入門、實戰與進階
- 新手易學:新手學淘寶開店
- Echo Quick Start Guide