Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Python 3.8 and Django 1.11 #104

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
024b3f7
Update to Python 3.5
russtoku Aug 9, 2024
4b299bd
Update README.md for Python 3.5
russtoku Aug 9, 2024
c0cd057
Remove unused requirement for raven
russtoku Oct 3, 2024
5a9a728
Works with Python 3.7.
russtoku Oct 3, 2024
f5cf450
Fix can't add public body and make request
russtoku Oct 4, 2024
7e895d9
Haystack connection for elasticsearch works with authN
russtoku Oct 5, 2024
e4b2632
Run 2to3 on all
russtoku Oct 5, 2024
f26ad21
Remove solr as search engine choice. Hide elasticsearch container.
russtoku Oct 6, 2024
8940337
Remove pysolr dependency.
russtoku Oct 6, 2024
7d12742
Elasticsearch work. Still have search problems.
russtoku Oct 8, 2024
595a33f
Log all request URLs during dev
russtoku Oct 9, 2024
51adda8
Set search service to use elasticsearch 2.x.
russtoku Oct 9, 2024
f6ec112
Works with Python 3.8 and Django 1.11.
russtoku Oct 14, 2024
91979ad
Add requirements-test.txt for testing with pytest; fix TEST_SELENIUM_…
russtoku Nov 15, 2024
606b906
Include froide source instead of being dependency
russtoku Nov 15, 2024
8aa9ca7
Add fixture for a regular user
russtoku Nov 16, 2024
6ac48e3
Update README to reflect inclusion of Froide source
russtoku Dec 13, 2024
e7a0830
Clarify why Froide source is included
russtoku Dec 13, 2024
2eccec2
Fix errors with publicbody/list.html and pagination.html
russtoku Dec 18, 2024
c38b431
Add fixture for another regular user
russtoku Dec 18, 2024
112cc6e
Python 3.8 requires digestmod argument for hmac.new()
russtoku Dec 19, 2024
1791b44
Fix footer on Account Settings to FAQ instead of Help
russtoku Dec 20, 2024
9af9326
Ignore missing key error in foirequest/list.html for Requests
russtoku Dec 22, 2024
b5889b1
Set DOCKER_DEFAULT_PLATFORM environment variable for docker compose
russtoku Dec 22, 2024
1fff231
Remove django-overextends because included since Django 1.9
russtoku Dec 22, 2024
262f88f
Don't propagate log messages for all loggers
russtoku Dec 23, 2024
f2a557d
Fix missing results in public body search
russtoku Dec 23, 2024
6c07431
Remove another part of django-overextends
russtoku Dec 24, 2024
a038397
Add filename comment to account/settings template.
russtoku Jan 11, 2025
78ecec4
Add site map documentation
russtoku Jan 11, 2025
f068f24
Update site map
russtoku Jan 11, 2025
b27f819
Add Django and Python versions to site map
russtoku Jan 11, 2025
117eb16
Update site map
russtoku Jan 11, 2025
03454e7
Add roadmap for in-place upgrade
russtoku Jan 11, 2025
9b94edc
Clean up roadmap
russtoku Jan 11, 2025
06e35de
Update roadmap and site map after merge of dj_1_11 into update branch
russtoku Jan 12, 2025
ed2896c
Fix spelling in site map
russtoku Jan 13, 2025
a145db5
Fix links in roadmap
russtoku Jan 24, 2025
2ef2e1e
Fix branch used to fork froide project
russtoku Jan 24, 2025
c0b7c6a
Move Getting Started section from README to its own page
russtoku Jan 25, 2025
c1b4d73
Use uv and pyproject.toml instead of requirements.txt
russtoku Jan 25, 2025
290f5f7
Add setuptools dependency to pyproject.toml
russtoku Jan 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,6 @@ solr-webapp

# Source for an editable project that pip installed
src

# MEDIA_ROOT for uploads
uipa_org/uploads/
147 changes: 26 additions & 121 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,34 @@
[![Stories in Ready](https://badge.waffle.io/codeforhawaii/uipa_org.png?label=ready&title=Ready)](https://waffle.io/codeforhawaii/uipa_org)

# UIPA.org - Uniform Information Practices Act portal

This is a basic Django project with a theme app that plugs into
[Froide](https://github.com/stefanw/froide). It's based on the [Froide Base
Theme](https://github.com/okfde/froide-theme).
> This branch is a departure from the main branch. It seeks to satisfy the goal
> of upgrading UIPA.org to currently supported versions of Python and Django
> without upgrading Froide to a newer upstream version.

This started as a Django project forked from the [Froide
Theme](https://github.com/okfde/froide-theme). This is a theme app that plugs
into [Froide](https://github.com/stefanw/froide) and is the recommended way of
creating a FOIA website by the Froide developers.

It will be easier to upgrade and maintain the UIPA project by combining the
Froide code into one Django project. This is due to the following problems:
- Upgrading UIPA to currently supported versions of Django and Python requires
lots of code changes to both UIPA and Froide.
- To satisfy the requirements to request information from Hawaii State and Local
government agencies (called public bodies in Froide), Froide was modified. This
required a fork but it has not been sync'd with the upstream since that point.
- The need to include Froide as an embeddable dependency due to the modified
fork.
- Maintaining a modified fork of an old Froide version (no version number
available) means maintaining two repos.

Going forward, the Froide code is no longer a dependency. It is included in the
source code of this project.

## Get started easily

Prerequisite libraries and programs:

* libmagic (yum install libmagic, apt-get install libmagic, etc.)
* Elasticsearch (download, unpack, and run with Java; https://www.elastic.co/downloads/elasticsearch)

In a Python virtualenv, run:

pip install -r requirements.txt -e . --src=./src
python manage.py migrate --noinput
python manage.py createsuperuser
python manage.py loaddata uipa_org/fixtures/*
python manage.py runserver

At this point, visit http://127.0.0.1:8000/ in your browser and you should see
the home page for uipa.org.

Be sure to remember the password for the admin user you create so that you can
log on to the admin interface at http://127.0.0.1:8000/uipa-admin/. You can
create or modify flatpages there.

### Searching for public agencies or requests

Once you have a running UIPA server, you'll want to be able to search for
public bodies or previously submitted requests for information. To so, you'll
need to:

* Dowload and install Elasticsearch
* Run an Elasticsearch server
* Build the indexes

```
python manage.py update_index
```

## Running UIPA on Heroku

There is a complete guide of how to set up Froide on Heroku at
http://froide.readthedocs.org/en/latest/herokudeployment/. For UIPA, you'll
need to interpolate a bit.


## Froide documentation

http://froide.readthedocs.org/en/latest/gettingstarted/

For details about working with Froide Themes see [Theming
Froide](http://froide.readthedocs.org/en/latest/theming/).


## Creating page content for the About, Help, Terms of Use, and Privacy Statement links

Django Flat Pages are used to create these pages. They are "flat" HTML content
stored in the database. For details, see [The flatpages
app](https://docs.djangoproject.com/es/1.9/ref/contrib/flatpages/)
documentation.

To create these pages initially, we:

* Create the pages using the Django administration interface at
http://127.0.0.1:8000/uipa-admin/. Click on the *Flat pages* link.
* Dump the database in JSON format (see below).
* Edit the dump file, `<db-dump>.json`.
* Copy the section of JSON data for the model, `flatpages.flatpage` (see
below).
* Put the JSON data in a file under the uipa_org/fixtures directory named
`flatpages.flatpage.json`.


### Loading the page data

Once the page data files have been created under the fixtures directory, they
can be loaded whenever a new instance of uipa.org is created. This is done by
loading the page data files using this command:

```
python manage.py loaddata <page>
```
where `<page>` is the name of the page data file without the `.json`
extension. Multiple pages can be loaded at the same time.


### Dumping the database

Dumping the database in JSON format is done using the command:

```
python manage.py dumpdata --indent 4 > db-dump.json
```


### Page data in JSON format

Here's an example of the page data in JSON format for the About page in the
fixtures/about-page.json:

```
[
{
"fields": {
"content": "<p>UIPA.org is the place where you can request information from your State of Hawaii government.</p>\r\n\r\n<p>UIPA stands for Uniform Information Practices Act and is the law covered by HRS Chapter 92F. It requires open access to government records. More information about the law can be seen at the State of Hawaii Office of Information Practices (OIP) website at <a href=\"http://oip.hawaii.gov/laws-rules-opinions/uipa/\">http://oip.hawaii.gov/laws-rules-opinions/uipa/</a>.</p>\r\n<p>You'll probably want to start with the <a href=\"http://oip.hawaii.gov/basic-qa-on-access-to-government-records/\">Basic Q&A on Access to Government Records</a> page where you can find out:</p>\r\n<ul><li>What types of records are public,</li><li>Who can request a record,</li><li>What government records are restricted or closed by law</li></ul></p>",
"enable_comments": false,
"registration_required": false,
"sites": [
1
],
"template_name": "help/page.html",
"title": "About UIPA.org",
"url": "/help/about/"
},
"model": "flatpages.flatpage",
"pk": 1
}
]
```

For developers and others who wish to contribute to this project, see [Getting
Started](docs/getting-started.md).

## License

Froide Theme is licensed under the MIT License.
Froide and the Froide Theme are licensed under the MIT License.
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
services:
db:
image: postgres:13
volumes:
- pg-data:/var/lib/postgresql/data/
environment:
POSTGRES_DB: uipa
POSTGRES_USER: uipa
POSTGRES_PASSWORD: uipa
ports:
- "127.0.0.1:5432:5432"
es:
build:
dockerfile: ./es.Dockerfile
volumes:
- es-data:/usr/share/elasticsearch/data
- es-logs:/usr/share/elasticsearch/log
ports:
- "127.0.0.1:9200:9200"

volumes:
es-data: {}
es-logs: {}
pg-data: {}
10 changes: 10 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Docs

This directory contains documentation for the UIPA.org project.

## Table of Contents

- [Getting Started](getting-started.md)
- [Site map of UIPA.org](uipa-site-map.md)
- [Roadmap for upgrade in-place](Roadmap.md)

Loading