Skip to content

Commit caffdf0

Browse files
committed
Finished first pass at rewriting the local development guide for getting started with django-calaccess-downloads-website for #28.
1 parent 0e9550c commit caffdf0

File tree

2 files changed

+82
-7
lines changed

2 files changed

+82
-7
lines changed

docs/contribute/calaccess_raw.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Now create the tables and get to work.
127127
$ python manage.py migrate
128128
129129
Once everything is set up, the :ref:`updatecalaccessrawdata` command will download the latest
130-
bulk data release from `the Secretary of State's website <http://www.sos.ca.gov/campaign-lobbying/cal-access-resources/raw-data-campaign-finance-and-lobbying-activity/>`_ and load it into your location database.
130+
bulk data release from `the Secretary of State's website <http://www.sos.ca.gov/campaign-lobbying/cal-access-resources/raw-data-campaign-finance-and-lobbying-activity/>`_ and load it into your local database.
131131

132132
.. code-block:: bash
133133
@@ -142,7 +142,7 @@ bulk data release from `the Secretary of State's website <http://www.sos.ca.gov/
142142
Exploring the data
143143
------------------
144144

145-
Finally, start the development server and visit `localhost:8000/admin/ <http://localhost:8000/admin/>`_ in your browser to inspect the CAL-ACESS data in your Django administration panel.
145+
Finally, start the development server and visit `localhost:8000/admin/ <http://localhost:8000/admin/>`_ in your browser to inspect the CAL-ACCESS data in your Django administration panel.
146146

147147
.. code-block:: bash
148148

docs/contribute/calaccess_website.rst

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,48 @@ whenever you deactivate the virtual environment:
8282
8383
$ unset CALACCESS_WEBSITE_ENV
8484
85+
---------------
86+
87+
88+
Connecting to a local database
89+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90+
91+
Unlike a typical Django project, this application only supports the MySQL and
92+
PostgreSQL database backends. This is because we enlist specialized tools to load
93+
the immense amount of source data more quickly than Django typically allows.
94+
95+
If you choose MySQL
96+
```````````````````
97+
98+
Create a new database named ``calaccess_website`` like this:
99+
100+
.. code-block:: bash
101+
102+
mysqladmin -h localhost -u root -p create calaccess_website
103+
104+
If you choose PostgreSQL
105+
````````````````````````
106+
107+
Create the database the PostgreSQL way.
108+
109+
.. code-block:: bash
110+
111+
$ createdb calaccess_website -U postgres
112+
113+
---------------
114+
115+
116+
Creating an archive on Amazon S3
117+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118+
119+
Even a development project needs that will run only on your computer needs an account with Amazon Web Services to
120+
store archived files in its S3 file service. If you don't already have an AWS account, `make one now <https://aws.amazon.com/>`_. `Request <http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.html>`_ a
121+
key pair that lets you access its services via Python. Then create a new `S3 "bucket" <http://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html>`_
122+
to store files archived by this project.
123+
124+
---------------
125+
126+
85127
Filling in .env for the first time
86128
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87129

@@ -101,11 +143,11 @@ Setting Required in development Definition
101143
db_name Yes Name of your database.
102144
db_user Yes Database user.
103145
db_password Yes Database password.
104-
rds_host Yes Database host location.
105-
aws_access_key_id No Shorter secret key for accessing Amazon Web Services.
106-
aws_secret_access_key No The longer secret key for accessing Amazon Web Services.
107-
aws_region_name No Amazon Web Services region where you resources are located.
108-
s3_archived_data_bucket No Amazon S3 bucket where archived CAL-ACCESS data will be stored.
146+
db_host Yes Database host location.
147+
aws_access_key_id Yes Shorter secret key for accessing Amazon Web Services.
148+
aws_secret_access_key Yes The longer secret key for accessing Amazon Web Services.
149+
aws_region_name Yes Amazon Web Services region where you resources are located.
150+
s3_archived_data_bucket Yes Amazon S3 bucket where archived CAL-ACCESS data will be stored.
109151
s3_baked_content_bucket No Amazon S3 bucket where the public-facing website will be stored.
110152
key_name No Name of the SSH ``.pem`` file associated with Amazon Web Services. Should be found in ``~/.ec2``.
111153
ec2_host No Public address of website's Amazon EC2 instance.
@@ -132,3 +174,36 @@ Or everything in the Fabric environment:
132174
$ fab printenv
133175
134176
---------------
177+
178+
Bootstrapping the project
179+
-------------------------
180+
181+
Now that everything is configured, create the database tables.
182+
183+
.. code-block:: bash
184+
185+
$ python manage.py migrate
186+
187+
Once everything is set up, the ``updatedownloadswebsite`` command will download the latest
188+
bulk data release from `the Secretary of State's website <http://www.sos.ca.gov/campaign-lobbying/cal-access-resources/raw-data-campaign-finance-and-lobbying-activity/>`_ load it into your local database and archive the files on Amazon S3.
189+
190+
.. code-block:: bash
191+
192+
$ python manage.py updatedownloadswebsite
193+
194+
.. warning::
195+
196+
This will take a while. Go grab some coffee.
197+
198+
---------------
199+
200+
Exploring the site
201+
------------------
202+
203+
Finally, start the development server and visit `localhost:8000/admin/ <http://localhost:8000/>`_ in your browser to inspect the site.
204+
205+
.. code-block:: bash
206+
207+
$ python manage.py runserver
208+
209+
------------------

0 commit comments

Comments
 (0)