You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This guide will help you get started with a Python project on CircleCI. If you’re in a rush, just copy the sample configuration below into `.circleci/config.yml` in your project’s root directory and start building.
12
+
If you're new to CircleCI 2.0, we recommend reading our [Project Walkthrough]({{ site.baseurl }}/2.0/project-walkthrough/) for a detailed explanation of our configuration using Python and Flask as an example.
13
13
14
-
Otherwise, we recommend reading our [walkthrough](#config-walkthrough) for a detailed explanation of our configuration.
- <ahref="https://github.com/CircleCI-Public/circleci-demo-python-django"> target="_blank">Demo Python Django Project on GitHub</a>
19
+
- <ahref="https://circleci.com/gh/CircleCI-Public/circleci-demo-python-django"> target="_blank">Demo Python Django Project building on CircleCI</a>
59
20
60
-
## Get the Code
21
+
In the project you will find a commented CircleCI configuration file <ahref="https://github.com/CircleCI-Public/circleci-demo-python-django/blob/master/.circleci/config.yml"target="_blank">`.circleci/config.yml`</a>. This file shows best practice for using CircleCI 2.0 with Python projects.
61
22
62
-
The configuration above is from a demo Python/flask app, which you can access at [https://github.com/circleci/cci-demo-flask](https://github.com/circleci/cci-demo-flask).
Fork the project and download it to your machine. Go to the [Add Projects](https://circleci.com/add-projects) page in CircleCI and click the Build Project button next to your project. Finally, delete everything in `.circleci/config.yml`.
25
+
The [Project Walkthrough]({{ site.baseurl }}/2.0/project-walkthrough/) uses a Flask application: <https://github.com/CircleCI-Public/cci-demo-python-flask>
65
26
66
-
Now we’re ready to build a `config.yml` from scratch.
27
+
## Pre-built CircleCI Docker images
67
28
29
+
We recommend using a CircleCI pre-built image that comes pre-installed with tools that are useful in a CI environment. You can select the Python version you need from Docker Hub: <https://hub.docker.com/r/circleci/python/>. The demo project uses an official CircleCI image.
30
+
31
+
Database images for use as a secondary 'service' container are also available.
32
+
33
+
## Build the demo Django project yourself
34
+
35
+
A good way to start using CircleCI is to build a project yourself. Here's how to build the demo project with your own account:
36
+
37
+
1. Fork the project on GitHub to your own account
38
+
2. Go to the [Add Projects](https://circleci.com/add-projects) page in CircleCI and click the Build Project button next to the project you just forked
39
+
3. To make changes you can edit the `.circleci/config.yml` file and make a commit. When you push a commit to GitHub, CircleCI will build and test the project.
68
40
---
69
41
70
42
## Config Walkthrough
@@ -77,110 +49,49 @@ version: 2
77
49
78
50
Next, we have a `jobs` key. Each job represents a phase in your Build-Test-Deploy (BTD) process. Our sample app only needs a `build` job, so everything else is going to live under that key.
79
51
80
-
We also need to specify container images for this build in `docker`.
81
-
82
-
We'll need to tell the Flask app to run in `testing` mode by setting it in `environment`, as well as where to find the database (DB). This is a special local URL linked to an additional Docker container.
52
+
We need to specify a working directory container images for this build in `docker` section:
Finally, let's specify where those test results are actually located.
177
-
178
-
```YAML
179
-
...
180
-
- store_test_results:
181
-
path: "test-reports/"
182
-
```
93
+
You can learn more about each of these steps in our [configuration reference]({{ site.baseurl }}/2.0/configuration-reference/)
183
94
184
-
Nice! You just set up CircleCI for a Flask app. Nice! Check out our [project’s build page](https://circleci.com/gh/circleci/cci-demo-flask).
95
+
Success! You just set up CircleCI 2.0 for a Python Django app. Check out our [project’s build page](https://circleci.com/gh/CircleCI-Public/circleci-demo-python-django) to see how this looks when building on CircleCI.
185
96
186
-
If you have any questions, head over to our [community forum](https://discuss.circleci.com/) for support from us and other users.
97
+
If you have any questions about the specifics of testing your Python application, head over to our [community forum](https://discuss.circleci.com/) for support from us and other users.
The source for the application is here: [cci-demo-walkthrough](https://github.com/circleci/cci-demo-walkthrough).
27
+
The source for the application is here: [cci-demo-python-flask](https://github.com/CircleCI-Public/cci-demo-python-flask).
28
28
29
29
### The Stack
30
30
@@ -41,7 +41,7 @@ Finally, we'll deploy the application to Heroku and discuss other deployment opt
41
41
To use CircleCI, your code must be available on GitHub or Bitbucket, in either a private or public repository. We'll be assuming GitHub for this walkthrough, but the same flow applies to Bitbucket as well.
42
42
43
43
<divclass="alert alert-info"role="alert">
44
-
<strong>Tip:</strong> If you're following along and want to use the code, you should fork and clone the <aclass="alert-link"href="https://github.com/circleci/cci-demo-walkthrough">cci-demo-walkthrough</a> project. On your local machine, delete the <code>.circleci</code> directory and make a commit. You now have a clean project ready to start configuring for use with CircleCI.
44
+
<strong>Tip:</strong> If you're following along and want to use the code, you should fork and clone the <aclass="alert-link"href="https://github.com/CircleCI-Public/cci-demo-python-flask">cci-demo-walkthrough</a> project. On your local machine, delete the <code>.circleci</code> directory and make a commit. You now have a clean project ready to start configuring for use with CircleCI.
0 commit comments