Code Monkey home page Code Monkey logo

semillas_platform's Introduction

semillas_platform

Built with Cookiecutter Django MIT License Travis-CI Coverage Codecov Updates Codacy Badge

Social Currency

It is a transparent, nonprofit platform for the exchange of goods and services in which participation don't require legal tender involvement.

It is based on the abundancy of resources, in the creative, artistic, manual and intelectual capacity of members. They could be children, elder people, teenagers, workers, housewives, unemployed, etc.

We are a community of developers willing to learn. Join us and we will give you fully support.

Apps Distribution

In Django the term application describes a Python package that provides some set of features. Applications may be reused in various projects.

We have the following main ones:

  • services: It contains a basic Service entity: Some service being offered or for sale.
  • semillas_backend/users: The User's models and views
  • landing: Visible landing website. No logic. No models.
  • swagger: Preview for every API endpoint. Check it here: API
  • wallet: App responsible of user wallet and movements

Setting Up Your Development environment with Docker Compose

Linux

Mac

Docker is native in Mac now. Drag and drop and enjoy.

Start Everything

Once docker compose is installed and running:

$ sudo docker-compose -f dev.yml up

Basic Commands

Run the migrations pending

Migrations are handled by Django. If you just set up your development environment probably there is a lot of migrations you have to run in your database so is in concordance with the models defined in the code.

  • See all migrations and which one is left to apply.

$ docker-compose -f dev.yml run django python manage.py showmigrations

  • Run all migrations with this command:

$ docker-compose -f dev.yml run django python manage.py migrate

Any change in any model can incur in a database migration. Check them here: https://docs.djangoproject.com/en/1.10/topics/migrations/

Setting Up Your Users

  • To create a normal user account, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go.

  • To create an superuser account, use this command::

$ docker-compose -f dev.yml run django python manage.py createsuperuser

For convenience, you can keep your normal user logged in on Chrome and your superuser logged in on Firefox (or similar), so that you can see how the site behaves for both kinds of users.

Test coverage

To run the tests, check your test coverage, and generate an HTML coverage report::

$ docker-compose -f dev.yml run django coverage run manage.py test
$ docker-compose -f dev.yml run django coverage html
$ open htmlcov/index.html

Running tests with py.test

$ docker-compose -f dev.yml run django py.test

Live reloading and Sass CSS compilation

Live reloading and SASS compilation http://cookiecutter-django.readthedocs.io/en/latest/live-reloading-and-sass-compilation.html

Email Server

In development, it is often nice to be able to see emails that are being sent from your application. For that reason local SMTP server MailHog with a web interface is available as docker container.

Mailhog: https://github.com/mailhog/MailHog

Container mailhog will start automatically when you will run all docker containers.

With MailHog running, to view messages that are sent by your application, open your browser and go to http://127.0.0.1:8025

Error Log: Sentry

https://sentry.io/semillas

Deployment

Whenever master branch is updated with a new commit or merge. A deploy will be triggered. Check it on https://www.semillasocial.org

Whatever is pushed to 'dev' branch it will automatically be deployed to http://alpha.semillasocial.org

Gulp Workflow

Gulp Tasks: What they do

We have two Gulp tasks

After running any Gulp task enter the folder where you have "Semillas Social" and run the following command:

npm init=> This will download every NPM dependency to your local machine

Then run:

gulp default=> This task runs the following tasks:

  • css: converts .scss files to .css
  • cssnano: minifies css
  • autoprefixer: add prefixes to the last 4 browser version

gulp img=> This task removes unnecesary image's metadata (lossless compression)

Deploy another instance of Semillas to Heroku

This is useful in case you are creating your own currency app. Once you have created your own instance of the Client with https://github.com/Semillas/AlternativeCurrencyApp

  • heroku addons:create heroku-postgresql:hobby-dev --app bitcoin-bazaar
  • heroku addons:add heroku-redis:hobby-dev --app bitcoin-bazaar
  • heroku addons:add mailgun:starter --app bitcoin-bazaar
  • heroku addons:add newrelic:wayne --app bitcoin-bazaar
  • heroku buildpacks:add https://github.com/Semillas/heroku-buildpack-geolite.git --app bitcoin-bazaar
  • heroku buildpacks:add https://github.com/dschep/heroku-geo-buildpack.git --app bitcoin-bazaar
  • heroku buildpacks:add heroku/python --app bitcoin-bazaar
  • heroku addons:add papertrail:choklad --app bitcoin-bazaar
  • heroku pg:copy postgresql-flexible-86889 fully-qualified-dest-url-db --app semilla (This is in case you want to copy de DB, remember to copy the media folder in AWS S3 too)
  • heroku stack:set cedar-14 --app bitcoin-bazaar
  • heroku config:add DJANGO_SETTINGS_MODULE=config.settings.production --app bitcoin-bazaar
  • heroku config:add DJANGO_AWS_ACCESS_KEY_ID= --app bitcoin-bazaar
  • heroku config:add DJANGO_AWS_SECRET_ACCESS_KEY= --app bitcoin-bazaar
  • heroku config:add DJANGO_AWS_STORAGE_BUCKET_NAME=bitcoinbazaar --app bitcoin-bazaar
  • heroku config:add DJANGO_SECRET_KEY='' --app bitcoin-bazaar
  • heroku config:add DJANGO_SENTRY_DSN= --app bitcoin-bazaar
  • heroku config:add DJANGO_ADMIN_URL=^admin/ --app bitcoin-bazaar
  • heroku config:add DJANGO_ALLOWED_HOSTS=bitcoin-bazaar.herokuapp.com --app bitcoin-bazaar

semillas_platform's People

Contributors

carquet avatar iesteban avatar ignaciodenuevo avatar josheriff avatar jsoriano avatar pilamb avatar pyup-bot avatar s-nt-s avatar sergimartnez avatar

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

Watchers

 avatar  avatar

semillas_platform's Issues

Translate to spanish the software tab.

There are many string in English regarding each software been used.
Also there are some sentences below "version" title which need a proper tranlation as well.
It would be very nice if they get translated.

Create User Method verify_pin

This will be called once the user has introduced the 4 digits he got (through SMS or last four digits of lost call).

  • Will call verify_pin from #58
  • Update phone_verified flag

Create Gallery for Service model and add it to serializer

PhotoService model will have:

  • service: foreign key to service (this way we achieve the one to many, many photos can be pointing to one service.
  • picture: models.ImageField(null=False, blank=False, ... )

Then they should be added to ServiceSerializer. And return them inside the json in a list ordered by id.
In the photos field. They can be added like in this example: http://www.django-rest-framework.org/api-guide/relations/#nested-relationships

Create User Model method: validate_phone

This will call CheckMobi service and verify the user implemented in #58

Parameter: phone properly formated (in the format CheckMobi requires)

  • Takes the phone properly formatted from the view
  • Saves the phone
  • Perform Request to CheckMobi
  • Return whether or not the CheckMobi Request was successful

Make default language English

To every user not having the browser in English, the web is showing up in Spanish.

So anyone from... France for example opening the web, it will be in Spanish.

Also in order to have the strings inside the code written in English would be great to have the default language as English.

Create API Views for Posts (Item)

Endpoint for the feed of items (posts) the user will see:

-/api/v1/posts/feed -> The feed ordered by the location/publishing time of the user.
- URL parameters:
- Lat: Latitude to order by geolocation
- Lon: Longitude to order by geolocation
- category: Category id to filter by that category
- search: String to search item using that string

The default order should be by distance.

In the future, another get param can be order with two options: distance, recent

Prepare Landing 'sign-up' and 'successfully signed-up' pages for gathering e-mails

The goal is to encourage people to sign-up in our landing page with the promise of keeping them up to date and notify them as soon as we launch the first version of the product.

So the sign-up should include a text like:
"We are not live yet, but we can keep you updated of our improvements and notify you once we launch"

And the after sign-up page should have a message like:
"Thanks a lot for joining. We will keep you posted. Keep reading about us" And a link to 'people' tab.

Feed Page: Request Position from user and send it to server.

When loading the feed, it should get the user position from the browser.

If the user allows the browser to retrieve it, it will update the user with the coordinates (PATCH /user/) and request the feed again.

It should also update the User with the permission option chosen (Browser not supported, permission denied, permission allowed).

Automate the configuration of social apps

Comes from #8 (comment) :

@iesteban says:

For the development environment, the approach I like the most is to create a script like populate_development_database. Which will be called every time we start the development environment.

That script, let's call it pre_start.py for example, will check there is an entry of a Facebook Provider in database and create if it's not there. Something like:

if not SocialApp.objects.filter(provider=Facebook):
facebook_provider = SocialApp(
provider=Facebook,
secret_key= '34567890',
...
)
facebook_provider.save()

And the place too call pre_start.py will be here: https://github.com/Semillas/semillas_backend/blob/master/compose/django/gunicorn.sh#L2

This will set the development key public. I think there is no problem at all. But maybe we should research a little bit.

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.