Coder Social home page Coder Social logo

v-ampire / djangosnippets.org Goto Github PK

View Code? Open in Web Editor NEW

This project forked from django/djangosnippets.org

0.0 0.0 0.0 955 KB

The code that powers djangosnippets.org, it allows users to post and share useful "snippets" of code.

Home Page: https://djangosnippets.org

License: BSD 3-Clause "New" or "Revised" License

Python 45.28% JavaScript 23.50% HTML 24.43% Ruby 0.28% CSS 2.23% Dockerfile 0.10% SCSS 4.08% Shell 0.10%

djangosnippets.org's Introduction

djangosnippets.org

This code is used to power the snippet sharing site, djangosnippets.org

Development setup

In a Python 3.7 virtual environment:

$ cd requirements
$ pip install -r development.txt
$ cd ..
$ python manage.py migrate

Now you can start the development server:

$ python manage.py runserver

Before you can actually use the site now you have to define at least one language. If you just want to use the ones from djangosnippets.org, they are included in the fixtures folder. Also included are 5 snippets to get you started:

$ python manage.py loaddata fixtures/cab.json

Now you should be able to use the development version of djangosnippets on port 8000.

Docker

You need to copy .env.example to .env and configure with your needs. The example is fine to start with development environment.

You may wish to use docker locally for production dependency testing and development, here are the setup instructions:

$ docker-compose -f docker-compose.yml build
$ docker-compose -f docker-compose.yml up -d

-d denotes running docker in a detached state:

$ docker-compose -f docker-compose.yml run web python manage.py migrate
$ docker-compose -f docker-compose.yml run web python manage.py createsuperuser
$ docker-compose -f docker-compose.yml run web python manage.py loaddata fixtures/cab.json
$ docker-compose -f docker-compose.yml run web python manage.py collectstatic

The docker setup is running as close as possible to the production setup in heroku:

Postgres 12.3 Gunicorn Redis

To run our tests with docker run the following:

$ docker-compose -f docker-compose.yml run web python manage.py test --settings=cab.tests.settings

Styling contributor?

DjangoSnippets uses the Foundation framework as core of its visual style. To get this working on your local machine you need compass and bower to compile your stylesheets. Please never modify the generated .css files directly but use the .scss ones.

To keep the setup path as short as possible, simply run following commands in your terminal:

$ cd djangosnippets/static
$ bower install && compass watch

If you don't have either of these two installed, you can find detailed instructions on their respective websites.

Please make sure, that you commit only a compressed version of the CSS file as this is what will be deployed. (In order to do that the default configuration inside djangosnippets/static/config.rb is output_style = :compressed)

Production setup

The production setup is right now tailored to Heroku and therefore mostly automatic. The difference between these two setups is configured in the djangosnippets.settings.production module and the requirements.txt.

djangosnippets.org's People

Contributors

alexander-ae avatar barttc avatar brylie avatar carltongibson avatar chriswedgwood avatar coleifer avatar daniboygg avatar dependabot-preview[bot] avatar dependabot[bot] avatar dplanella avatar felixxm avatar gostich avatar jezdez avatar manaswinidas avatar markush avatar ppmdo avatar santos22 avatar sijanonly avatar stephrdev avatar timgraham avatar zerok avatar

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.