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 for Python 3.5 #104

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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/
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,35 @@ Theme](https://github.com/okfde/froide-theme).

Prerequisite libraries and programs:

* Python 3.5 in a virtual environment (python -m venv venv3)
* libmagic (yum install libmagic, apt-get install libmagic, etc.)
* Elasticsearch (download, unpack, and run with Java; https://www.elastic.co/downloads/elasticsearch)
* Docker
* Desktop (Mac or Windows) - See [Overview of Docker Desktop](https://docs.docker.com/desktop/)
* Engine (Linux) - See [Docker Engine overview](https://docs.docker.com/engine/)

In a Python virtualenv, run:

Clone this repo and change into the directory that the repo was cloned to.

Start a PostgresQL docker container using:

docker compose -d

After activating your Python 3.5 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.

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


### Searching for public agencies or requests

Once you have a running UIPA server, you'll want to be able to search for
Expand Down
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
services:
db:
image: postgres:13
volumes:
- uipa-pg-data:/var/lib/postgresql/data/
environment:
POSTGRES_DB: uipa
POSTGRES_USER: uipa
POSTGRES_PASSWORD: uipa
ports:
- "127.0.0.1:5432:5432"
# elasticsearch:
# image: docker.elastic.co/elasticsearch/elasticsearch:8.14.1
# volumes:
# - es-data:/usr/share/elasticsearch/data
# - es-logs:/var/log
# environment:
# - "discovery.type=single-node"
# - "xpack.security.enabled=true"
# - "ELASTIC_PASSWORD=froide"
# - "cluster.routing.allocation.disk.threshold_enabled=false"
# - "cluster.routing.allocation.disk.watermark.low=3gb"
# - "cluster.routing.allocation.disk.watermark.high=2gb"
# - "cluster.routing.allocation.disk.watermark.flood_stage=1gb"
# ports:
# - "127.0.0.1:9200:9200"

volumes:
#es-data: {}
#es-logs: {}
uipa-pg-data: {}
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
pip==8.1.1
django==1.10.2
django-appconf==1.0.2
Markdown==2.6.6
celery==3.1.23
celery-haystack==0.10
django-haystack==2.5.0
django-haystack>=2.5.0
django-celery-email==1.1.4
django-taggit==0.18.1
pytz==2016.6.1
requests==2.11.1
django-floppyforms==1.6.2
-e git://github.com/stephenmcd/django-overextends.git@master#egg=django-overextends
-e git+https://github.com/stephenmcd/django-overextends.git@master#egg=django-overextends
python-magic==0.4.6
django-tastypie==0.13.3
python-mimeparse>=0.1.4
Expand All @@ -27,9 +27,9 @@ pysolr==3.5.0
python-docx==0.8.5
elasticsearch==2.3.0

-e git://github.com/codeforhawaii/froide.git@master#egg=froide
-e git+https://github.com/codeforhawaii/froide.git@master#egg=froide

# -e git://github.com/stefanw/django-compressor.git@patch-1#egg=compressor
# -e git+https://github.com/stefanw/django-compressor.git@patch-1#egg=compressor
psycopg2==2.7.1
lxml==3.4.4
raven==5.32.0
Expand Down
43 changes: 43 additions & 0 deletions uipa_org/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,18 @@ def COMPRESS_OFFLINE_CONTEXT(self):
"STATIC_URL": super(Dev, self).STATIC_URL
}

# uploads subdirectory in the directory where this settings file lives.
MEDIA_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'uploads')

CACHES = {
'default': {
'LOCATION': 'dev-uipa',
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
}
}

SECRET_KEY = 'make_me_unique!!'

LOGGING = {
'version': 1,
'disable_existing_loggers': True,
Expand Down Expand Up @@ -308,6 +313,44 @@ def COMPRESS_OFFLINE_CONTEXT(self):

HAYSTACK_SIGNAL_PROCESSOR = 'celery_haystack.signals.CelerySignalProcessor'

HAYSTACK_CONNECTIONS = {
##'default': {
## 'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
## 'URL': 'http://127.0.0.1:8983/solr/uipa/',
## 'INDEX_NAME': 'haystack',
##}
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
}
}

DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.sqlite3', # Load from fixtures doesn't work with SQLite3.
#'NAME': 'dev.db',
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'uipa',
'USER': 'uipa',
'PASSWORD': 'uipa',
'HOST': 'localhost',
'PORT': '5432',
}
}

# Send email to the console
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

@property
def FROIDE_CONFIG(self):
config = super(Dev, self).FROIDE_CONFIG
config.update(dict(
dryrun=False,
make_public_num_days_after_due_date=365,
doc_conversion_binary="/Applications/LibreOffice.app/Contents/MacOS/soffice",
))
return config

TEST_SELENIUM_DRIVER = 'chrome'

class Beta(SentryEnabled, NginxSecureStaticEnabled, S3Enabled, SslEnabled, UipaOrgThemeBase, Base):

Expand Down
4 changes: 2 additions & 2 deletions uipa_org/theme/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from django.conf import settings
from django.core.files import File
from django.dispatch import receiver
from doc_utilities import create_uipa_document_request_from_foi_request
from doc_utilities import prepare_for_final_archiving
from .doc_utilities import create_uipa_document_request_from_foi_request
from .doc_utilities import prepare_for_final_archiving
from froide.foirequest.file_utils import convert_to_pdf
from froide.foirequest.models import FoiAttachment
from froide.foirequest.models import FoiRequest
Expand Down