Giter Club home page Giter Club logo

website's Introduction

okfn.org

Run tests codecov

This is the Django/Django CMS project that runs http://okfn.org.

When do I need to modify this?

http://okfn.org/ runs on Django CMS.

Most of the contents are provided via plugins and our communication person is currently responsible to edit the content or add new stuff to the site. It is the idea, and the goal of the development that all content is dinamically handled by plugins. This means that we are aiming to have templates with placeholders instead of text. So, if you need to modify content, probably you can already do it using Django CMS built in capabilities.

If we need to make global styling or data model changes, then we need to edit the code in this repo.

Prerequisites and assumptions

You must have the following installed:

  • Python 3.10
  • Node JS 16

The /Dockerfile (used for staging/production) and the requirements file (built with pip-tools) in this repo shows you the application dependencies.

Development

Database

It is possible to run the app with no database content. If databaset settings are not set, we fall back to a blank SQLite database (defined in the .env.base file) so this step can be skipped for a minimal case.

To run with a database, you will need a local Postgres server.

  • Get a dump of the database (we store them as *.sql in Google Cloud Storage)
  • Create a local database sudo -u postgres createdb okfn
  • Populate it sudo -u postgres psql okfn < file=/path/to/dump.sql or sudo -u postgres pg_restore -d okfn path/to/dump.dump

Running the application

Cherry-pick environment variables from .env.example you'd like to set and add it to the .env file. If no env vars are set, we will fall back to default .env.base file.

If running with Postgres, you will need to set:

DB_ENGINE=django.db.backends.postgresql_psycopg2
DB_NAME=okfn
DB_USER=user
DB_PASSWORD=pass
DB_HOST=localhost
DB_PORT=5432

Prepare the app:

Make sure to have the correct node version:

nvm install 16
nvm use 16

Create a Python 3.10 local environment (e.g. python3.10 -m venv ~/okf-website-env)

pip install -r requirements.txt
pip install -r requirements.dev.txt
npm install
python manage.py migrate
python manage.py update_index

Start the server:

python manage.py runserver

Another option is to use Docker.

docker build -t okfn .
docker run -d -p 8888:80 okfn

File uploads

Because this is a CMS project, a lot of the site content is created via the web UI. This means a lot of the images on the site are file uploads. In staging and production, the uploaded files are hosted on Google Cloud Storage.

If you want to get all production/staging media files you can download them from Google Cloud Storage and put them in a local media directory (MEDIA_ROOT from settings).

Note: A dump of the production database will require all the media files of production. Same for staging.

Frontend

CSS

Currently we are using Tailwind, PostCSS as our CSS stack. Please check the documentation to get a sense of how it works: Installing Tailwind CSS as a PostCSS plugin

The css build is done by PostCSS and the configuration files for it are tailwind.config.cjs and postcss.config.cjs.

Running npm run build will compile our main styles.css file and place it in static/css/styles.css. (It then will be collected by Django when building the Dockerfile)

Remember: Tailwind CSS works by scanning all of our HTML files, JavaScript components, and any other templates for class names to generate styles.css. If you ar adding new files, make sure to update the content field tailwind.config.cjs. (If required)

Javascript

We have some minimal Javascript features in the website. Our dependencies are in js/vendor/* and our main script in js/main.js.

Backend (Django and django-cms)

New plugins for blocks of content are located on foundation/okfplugins.

  1. Create a folder on foundation/okfplugins having:
  • admin.py: used on Django Admin interface
  • cms_plugin.py: configuration to appear on the Django CMS content editor sidebar
  • templates/: the django template files (access the plugin variable defined on models.py with instance.VARIABLE)
  • models.py: the model for the plugin object on the database

You can copy a simple plugin as heading or just_text and change the files above. If you do that don't forge to delete the migration files inside migrations/, except by init.py.

  1. Add the plugin to foundation/settings.py (INSTALLED_APPS setting).

  2. Run python manage.py makemigrations after you create the models.py.

  3. Run the migration to change the database with python manage.py migrate

  4. Start the server with python manage.py runserver

References for new design and components

Deployment

Production deployment is based on this Dockerfile. When we want to deploy, we just push to main branch (or develop branch for staging environment).

For more info read this doc.

Dependency Management

Dependencies are managed with pip-tools. Add new packages to requirements.in / requirements.dev.in and compile requirements.txt / requirements.dev.txt with pip-compile.

You can run pip list --outdated to see outdated packages.

Changelog

All changes must be documented at the CHANGELOG file

website's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

website's Issues

Resources page

A directory of (mostly) our best supporting materials/fundamental resources

Put under Why Open

Create sitemap / content blocks+structure

Create sitemap (content blocks+structure) for the new page. What is it that we want to have on the page and how do we want to structure it? Use this to create the initial backlog of tickets.

Ideas go into discussions for this ticket.

Components (we agree on) should be small and each goes into a new issue in this issue tracker.

Governance page

Create content for the Governance page

This goes under About

Set up CloudFront distributions for the asset buckets

We should serve the assets from a CDN rather than directly out of buckets. This will result in faster page loads for our users.

This will involve setting up a CloudFront distribution for the relevant buckets, and tweaking the asset pipeline configuration so that STATIC_URL/MEDIA_URL points to CF.

Link to the open definition

Create a link to the Open Defnition in the navigational bar (or make it prominent in some other way) under What is Open

What to save from current okfn.org

What do we want to salvage from the current http://okfn.org -- content wise) and present (possibly in a different way) on the new okfn.org website?

Put links (and reason if you can) in comments to this issue.

Decide on technical approach

In parallel with ongoing discussions (#1, #2) about what the content and information architecture of the new site should be, I'd like us to start discussing options for creating, managing, hosting and operating the new okfn.org.

In what follows, our discussion should be driven by the following concerns, in rough order of priority. Please also feel free to question these items and their relative priority:

  1. The ease with which we will be able to adapt the chosen technologies to our external user's needs (navigation, searchability, responsiveness of layout, performance) [USER]
  2. The ease with which the site content can be maintained and updated over the long term by OKF central staff with varying degrees of technical interest or skill. [CONT]
  3. The ease with which technical staff can update and maintain layout templates and styles, and adapt these to changes in browser technology or device usage. [DSGN]
  4. The amount of up-front effort required to duplicate the (needed) functionality of the existing okfn.org. [EFFT]
  5. The breadth and quality of the existing community surrounding the chosen technologies. [CMTY]
  6. The quality and stability of the the technology in question, including evidence of QA and automated testing. [QUAL]
  7. The ease with which can develop custom features if necessary and integrate them with the site (e.g. a jobs page, events listings, etc.) [CSTM]
  8. The ease with which we can deploy the site. This includes considerations such as asset pipeline management, integration with external storage (S3) and a CDN, where appropriate, and the ease of managing a staging environment [DPLY]

Donation page

We want to be able to receive donations from people.

  • Donation form, with options for different one-off and recurring donations. We should make the default something like $10/month recurring.
  • Assurances about security of donation, tax-deductibility, other ways of donating, etc.

Should we also be considering payment provider? PayPal is a pretty nasty organisation, and things like Stripe now work in the UK: https://stripe.com/.

Most content should be directly portable from our existing "Support" page: http://okfn.org/support/

Basic page

Must at least include authentication and publishing of pages

About page

Create content for the main about page.

  • who we are
  • mission

Contact pages

We need a generic contact page that achieves the following things:

  • People who actually want to get in touch with individual communities are clearly signposted to those places.
  • People who actually want to get in touch with OKF Central can do so
  • People who want to find out our registered address, phone number, company number, etc, can do so.

Homepage theme block

Here is the 'content' for the theme teasers on the homepage.
Here are the content bits for the homepage blocks that point to the theme landing pages. Each set has the headline, some image direction in braces (my two cents on the design is that images would be good to include here), and the shortest blurb I could manage. Each block will link to a theme landing page, which I will do a wireframe for.

Laura is not totally keen on this language so it's possible things could change, meaning where feasible can we please use editable text.

These should feel less important than the services/community blocks and equal to or better, but distinct from the project highlights in terms of presence on the page.

{Main Header} Open Knowledge Focal Points/Lenses/Key Themes
{still thinking, suggestions? trying to attract a pretty lay audience, these are meant to be more easy on ramps into deeper content than they are definitive explanations of our areas of expertise or offerings.}

  1. Global Challenges
    {poverty and climate change}
    Open information is essential to help everyone understand the issues confronting our planet, discover and try out solutions, and keep track of the risks and successes.
  2. Citizenship and Governance
    {taxes, spending, elections}
    Everyone should have free and open access to information about how their society operates so that governments can be scrutinised and held to account.
  3. Research, Science and Culture
    {Health/medicine, human knowledge}
    Free access to the sum of human knowledge enables everyone to fully understand their lives and our world, make informed choices, and build a better future together.
  4. Consumer Protection and Business Accountability
    {food, products, corporate ownership}
    {could potentially be shortened to just 'Consumer Protection''}
    To tackle corruption we have to know who owns and controls businesses, so that poor governance and damaging social and environmental practices can be uncovered.

User accessible thumbnailer

We should probably put up some sort of an image resizing mechanism to create smaller versions of the big images uploaded. I don't think we can force people to remember to manually resize picture.

Media upload

Reusable stuff to upload media on various pages

Asset pipeline

Asset pipeline/publishing to S3 (or something similar)

discuss how we'll handle sidebars

We need to agree on how we'll handle sidebar content so that I can make content recommendations in line with that and produce the content in a corresponding workflow.

Sign up/community registration

  • Decide where this data should go (Sendy, Action Network, Mailchimp)
  • Establish from where on the site a sign up form should be visible
  • Add the relevant sign up forms etc.

What is open page

Create content for the landing page of What is open

From current page:

  • what,
  • what kinds,
  • why

Blog integration

I think given the limited time available to this project the right thing to do is simply to remap the existing blog so that it lives at /blog/ rather than on a separate domain.

  • Decide how to integrate the blog.
    • nginx reverse proxy for /blog/?
  • Theme for blog (or does this come later)
  • Update navigation for blog

Job page

Depends on #17 and we should try to make it easy to do stuff and conform (visually and structurally) with everything in the past and future.

Analytics

Include Google Analytics with a lot of tracking enabled so we will from day one know how people use our site

Press area

We want a press area for the site, including:

  • Press release archives {first few appear on landing page}

Glossary page

Create content for glossary page (under Why Open)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.