{"id":21203161,"url":"https://github.com/serenasensini/TheRedCode-Docker-per-Django-e-Postgres","last_synced_at":"2025-10-02T10:30:30.663Z","repository":{"id":108082386,"uuid":"433447857","full_name":"serenasensini/Docker-per-Django-e-Postgres","owner":"serenasensini","description":"How to dockerize Django application with Postgres using DjangoGirls Italia project! #theredcode #theredcodeit","archived":false,"fork":false,"pushed_at":"2022-04-04T15:26:48.000Z","size":100781,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T11:56:07.620Z","etag":null,"topics":["django","docker","sqlite"],"latest_commit_sha":null,"homepage":"https://www.theredcode.it/docker/docker-con-django-e-sqlite/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serenasensini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-30T13:48:13.000Z","updated_at":"2022-02-09T12:25:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"794e9207-4dfe-42c3-b253-fffa3fe99025","html_url":"https://github.com/serenasensini/Docker-per-Django-e-Postgres","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serenasensini%2FDocker-per-Django-e-Postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serenasensini%2FDocker-per-Django-e-Postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serenasensini%2FDocker-per-Django-e-Postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serenasensini%2FDocker-per-Django-e-Postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serenasensini","download_url":"https://codeload.github.com/serenasensini/Docker-per-Django-e-Postgres/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234970027,"owners_count":18915304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","docker","sqlite"],"created_at":"2024-11-20T20:21:39.759Z","updated_at":"2025-10-02T10:30:20.652Z","avatar_url":"https://github.com/serenasensini.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Girls website\n\n[![Build Status](https://travis-ci.org/DjangoGirls/djangogirls.svg?branch=master)](https://travis-ci.org/DjangoGirls/djangogirls) [![codecov](https://codecov.io/gh/DjangoGirls/djangogirls/branch/master/graph/badge.svg)](https://codecov.io/gh/DjangoGirls/djangogirls)\n\n\nThis repository contains the Django application which powers [DjangoGirls.org](http://djangogirls.org/).\n\n## What's in it?\n\nIt's a simple CMS that contains 3 main models:\n\n- __Event__ - a list of events and their website configuration\n- __EventPageContent__ - blocks of content that are visible on the website\n- __EventPageMenu__ - items of menu of every website\n\n## How to create new event?\n\nSimply go to command line and run this command:\n\n    python ./manage.py new_event\n\nAnd then follow the instructions.\n\n## How to manage your website?\n\n### Event\n\nhttp://djangogirls.org/admin/core/event/\n\nHere you can change:\n- Meta tags - title and description of the website\n- Main color - main color on the website in HEX (default is FF9400)\n- Custom CSS - customize CSS on the website\n- URL - url that goes after the domain (http://djangogirls.org/__url__)\n- Is live? - live website is available [on the homepage](http://djangogirls.org/) and can be accessed by anyone\n\n### EventPageContent\n\nhttp://djangogirls.org/admin/core/eventpagecontent/\n\nEach website comes with some default content that you can adjust to your needs. Each object is a \"block\" on the website that you can modify in following ways:\n- Name - it's also a permalink that you can link to like this: __#name__\n- Content - HTML is allowed\n- Background - there are two available types of blocks: without background and with background. By uploading image you're choosing the type with background.\n- Is public - check this if you want this block to be visible\n\n### EventPageMenu\n\nhttp://djangogirls.org/admin/core/eventpagemenu/add/\n\nTo manage menu available on the website, you can add objects to EventPageMenu. Available options:\n- Title\n- URL\n\n\n# Contributing to Django Girls website\n\nThe website is hosted on PythonAnywhere and is available here: http://djangogirls.org/\n\nPlease note that we use Python 3 only, so make sure that you use correct version when running commands below.\n\n## Setting up a development environment\n\nFirst, clone the repository:\n\n    git clone git@github.com:DjangoGirls/djangogirls.git\n\nStep into newly created `djangogirls` directory:\n\n    cd djangogirls\n\nCreate a new virtual environment (python 3.9) if needed. Then, install all the required dependencies.\nThe dependencies are compiled by [pip-tools](https://github.com/jazzband/pip-tools), which\ncompiles `requirements.txt` ensuring compatibility between packages.\n\n    pip install pip-tools\n    pip-sync\n\nThere is more information on how `pip-tools` work below.\n\nStart the [PostgreSQL database server](http://www.postgresql.org/docs/current/static/server-start.html) and enter the `psql` shell (you need to have [PostgreSQL](http://www.postgresql.org/download/) installed):\n\n    psql\n\nIn the `psql` shell, create a database and a role with the necessary permissions:\n\n    CREATE DATABASE djangogirls;\n    CREATE ROLE postgres;\n    GRANT ALL privileges ON DATABASE djangogirls TO postgres;\n    ALTER ROLE postgres WITH LOGIN;\n\nExit the `psql` shell:\n\n    \\q\n\nRun the migration to create database schema:\n\n    ./manage.py migrate\n\nLoad sample data to the database\n\n    ./manage.py loaddata sample_db.json\n\nCreate a user so you can login to the admin:\n\n    ./manage.py createsuperuser\n\nInstall dependencies for static files:\n\n    npm install\n\nCompile CSS and JS files:\n\n    gulp watch\n\nRun your local server:\n\n     ./manage.py runserver\n\n:tada: You're done.\n\n\n## Run the tests\n\nYou can run the tests like this:\n\n\tpython -m pytest\n\nOr if you want coverage reports:\n\n\tpython -m pytest --cov\n\n\nFor a coverage report with information about missing lines, run this:\n\n\tpython -m pytest --cov-report term-missing --cov\n\n\n### Static files\n\nWe're using a [Stylus](http://learnboost.github.io/stylus/) as our CSS pre-processor. [Get styling with Stylus](http://learnboost.github.io/stylus/#get-styling-with-stylus).\n\nThis means you shouldn't change any css files, but `.styl` files. They're in `/static/source/css/` directory.\n\nAutocompiling of `.styl` files to `.css`:\n\n    npx gulp watch\n\nWe're also using gulp for our static files builds (see [below](#gulp-tasks)). To build static files for production, run this:\n\n    npx gulp build\n\nFor local development:\n\n    npx gulp local\n\n#### Gulp Tasks\n\nStatic files are generated and maintained using [gulp.js](https://gulpjs.com/). To use, you'll need Node.js [installed](https://nodejs.org/en/download/). Then, run `npm install`. You can now use `npx gulp` (note that it's `np**x**`), followed by one of the following commands:\n\n* `gulp local` - run a one-off local build of css \u0026 js\n* `gulp watch` - compile and watch static assets for changes\n* `gulp build` - run a one-off production build, which involves minifying code and asset revision markers\n* `gulp clean` - remove the results of any of the above commands\n\nRunning `gulp` on its own runs `watch` by default.\n\n#### Developing Gulp Tasks\n\nEach gulp task is a single function, which are combined using the `series` operator so they run as a workflow. Each are commented with what they do and why they're important. \n\nThe biggest gotcha is [async completion](https://gulpjs.com/docs/en/getting-started/async-completion#signal-task-completion). Each task much signal to gulp when it has finished. The easiest way to do this is using an `aysnc` function, **but** if your functionality uses gulp streams (most native gulp functionality does), then you should **not** use an `async` function. Instead, return the gulp stream from the function and it will be handled correctly.\n\n```js\n// WRONG - uses gulp's streams in an async function; subsequent tasks won't wait for completion correctly:\nconst copyFiles = async () =\u003e {\n    return gulp.src(...).pipe(gulp.dest(...))\n}\n\n// RIGHT - either returns a gulp stream _or_ uses an `async` function:\nconst copyFiles = () =\u003e {\n    return gulp.src(...).pipe(gulp.dest(...))\n}\nconst deleteFiles = async () =\u003e {\n    await del(...)\n}\n```\n\n### Hosting on PythonAnywhere\n\nKey bits of config and secrets are stored in environment variables in two places:\n\n* in the WSGI file (linked from the Web Tab)\n* in the virtualenv postactivate at ~/.virtualenvs/djangogirls.com/bin/postactivate\n\n\n### Google Apps API integration\n\nWe're using Google Apps Admin SDK for creating email accounts in djangogirls.org domain automatically.\n\nSeveral things were needed to get this working:\n\n1. Create an app in Developer Console\n2. Create a service account to enable 2 legged oauth (https://developers.google.com/identity/protocols/OAuth2ServiceAccount)\n3. Enable delegation of domain-wide authority for the service account.\n4. Enable Admin SDK for the domain.\n5. Give the service account permission to access admin.directory.users service (https://admin.google.com/AdminHome?chromeless=1#OGX:ManageOauthClients).\n\n\n### Using pip-tools\n\nThe packages required by the project are in `requirements.in` which looks like a regular requirements file. Specific versions of packages can be\nspecified, or left without a version in which case the latest version which is compatible with the other packages will be used.\n\nIf you are working on a feature which requires a new package, add it to `requirements.in`, specifying a version if necessary.\nIt's dependencies will be included in `requirements.txt` by the compile process. \n\nThe only time a dependency of a third party package needs adding to `requirements.in` is when a version has to be pinned.\n\nBy running `pip-compile` the requirements are compiled into `requirements.txt`.\n\nPeriodically requirements should be updated to ensure that new versions, most importantly security patches, are used. \nThis is done using the `-U` flag.\n\nOnce requirements are compiled, `pip-sync` will install the requirements, but also remove any packages not required.\nThis helps to ensure you have the packages required, but also that there isn't something installed that's missed \nfrom `requirements.txt`.\n\nFor example:\n\n    pip-compile -U\n\n    pip-sync\n\n\n### Handling environment variables\n\nThe `requirements.txt` installs [python-dotenv](https://pypi.org/project/python-dotenv/) which provides the option for\ndevelopers to load environment variables via a single file.\n\nYou'll see `.environment-example` in the project root. This contains environment variables used by the project so that\nyou can create your own copy of this and load it with values relevant to your development environment.\n\nTo make use of this feature, create a copy of the example file and call it `.environment`. This file will be ignored by\nversion control, but loaded by `manage.py`. So when you run django commands like `manage.py runserver` during development\n`python-dotenv` will load the environment variables from your `.environment` file so that they are available to the application.\n\nThis is an optional feature. If you do not have a `.environment` file then it won't impact on the application at all.\n\n## Help with translation of the website\nJoin us on [poeditor.com](https://poeditor.com/join/project?hash=n5I3liMVyj) to help with translation of the website so \nthat non-English speakers can view the website based on their locale.\n\nLanguages available for translation are;\n\n* French\n* German\n* Korean\n* Persian\n* Portuguese\n* Portuguese (BR)\n* Russian\n* Spanish\n\nSee [issue 571- Website internationalization/translations ](https://github.com/DjangoGirls/djangogirls/issues/571) for further details. \nAlternatively submit the pull request to the `translations` branch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserenasensini%2FTheRedCode-Docker-per-Django-e-Postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserenasensini%2FTheRedCode-Docker-per-Django-e-Postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserenasensini%2FTheRedCode-Docker-per-Django-e-Postgres/lists"}