Giter Site home page Giter Site logo

fueled / django-init Goto Github PK

View Code? Open in Web Editor NEW
187.0 28.0 46.0 2.01 MB

Project template used at Fueled for scaffolding new Django based projects. :dizzy:

License: Other

Python 60.19% Shell 7.42% HTML 3.68% JavaScript 0.02% CSS 2.76% Smarty 0.49% Makefile 1.77% Jinja 20.84% Procfile 0.11% Dockerfile 2.73%
django ansible boilerplate ubuntu aws python3 mkdocs django-environ letsencrypt cookiecutter-template

django-init'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

django-init's Issues

Upgrade to Django 1.9

  • Remove string based call from urls
  • Remove django-flat-themes as it now comes built-in
  • Remove NullHandler from logging
  • Replace django.core.context_processors to django.template.context_processors (django11 deprecated)
  • Use new views for preview of 4xx pages

Roadblocks:

Add support for build status badge

Should show the travis status in the README and docs/index.md

why

Make the iOS developer about the deployment status on development environment. Then subsequently if dev is passing, there are very high chance that build of qa and prod is passing too.

No dependencies mentioned

In the project Readme.MD there is no information about which dependencies there are, but there are actually quite some dependencies.

As a first time runner of the cookiecutter django it has a lot of requirements that are not stated anywhere.

Missing License

Looks like the license is missing on this. Great template though guys

Support Python3 only

Many popular packages now support python3.x. We should stop supporting python2.x

But there are certain configuration packages that are python2 only:

  • Fabric ( Can use MakeFile)
  • Ansible (Can be replaced with shell scripts.)
  • Supervisor ( Can use circus instead.)

Switch to uswgi for http and static files handler

  • why? https://twitter.com/_theskumar/status/658328278902566912
  • Better error reporting.
  • Better performance by default.
  • Removes dependency on whitenoise for serving static files (less configs).
  • Allows to switch to S3 without any configuration change.
  • Lot's of other goodies when needed like background processing, async email backend without celery
  • Read More: https://uwsgi-docs.readthedocs.org/en/latest/
  • Widely recommended and used by python community.
  • Native support by nginx for a backend proxy server.

Values to be use in uwsgi.ini

[uwsgi]
http-socket = :$(PORT)
master = true
processes = 4
die-on-term = true
module = wsgi:application
memory-report = true
offload-threads = 4
static-map = /static=.staticfiles

# the below is required by new relic. be sure to monitor your system
# memory since we're enabling threads
# https://newrelic.com/docs/python/python-agent-and-uwsgi
enable-threads = true
single-interpreter = true
lazy-apps = true

Further Reading:
http://blog.kgriffs.com/2012/12/18/uwsgi-vs-gunicorn-vs-node-benchmarks.html

drop support for css frameworks

Remove Foundation as there are not much of the Frontend development that happens, and make it lean and free from any dependency. Twitter Bootstrap can be added as and when required in a project. With couple of lines. Fueled frontend team doesn't use any css framwork either.

Use base.html closer to what we have in html5-boilerplate.

Update Python Version to 3.x in .travis.yml

Recently I was using Fueled Cookie-cutter for one of my personal project. Don't you think that we should update the Python version to 3.x in .travis.yml .

Also, I faced this issue today and I guess in Public cookiecutter there is already an issue for this. Which is including runtime.txt file for Python version for Heroku Deployment.

Your thoughts?
If you want I can send in a PR

Make graphviz optional or remove it

why

  • It's hard to install on different systems.

solution

  1. Provide an option to include graphviz during the scaffolding of project.
  2. remove graphviz altogether, the developer need to include it manually just when he needs to add database diagrams.

Gitlab CI support

Gitlab is a web-based Git repository manager with unlimited private repositories.
Each repository has integrated CI and CD to test, build and deploy your code. Each build can be split in multiple jobs that run in parallel on multiple machines.

Check Gitlab CI

I am using Gitlab CI in couple of my projects. We can add it to django-init too.

Make 'devrecargar' package optional

It seems that the devrecargar is preventing us from having the DJANGO_DEBUG on True as it tries to add extra urls to the urls.py on our development servers.

I'm not sure if we ever use this package other then when we are doing frontend and backend that is merged with each other. My vote would be to remove this behavior as we want to start using WebPack #182, thoughts?

Provide option, whether or not to run cookiecutter hooks

Sometime you just don't want the magic to happen and only want the file to be generated.

how to
In hooks/post_gen_project.sh, ask for the user whether to run the hooks or not.

cookicutter itself doesn't provide any such option.

UnicodeEncodeError: 'ascii' codec can't encode characters in position 52-53: ordinal not in range(128)

I recently tried to install the following on my machine. Configurations are as follows :
Python 2.7.x
Ubuntu 12.04 LTS
All the other dependencies seems to get installed correctly. But there seems to be problem in requirements/development.txt and in the traceback I am getting the following error. Any luck with this??

Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 223, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 955, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1072, in unpack_url
return unpack_http_url(link, location, self.download_cache, only_download)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 447, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 464, in unpack_file
unzip_file(filename, location, flatten=not filename.endswith('.pybundle'))
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 366, in unzip_file
leading = has_leading_dir(zip.namelist()) and flatten
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 185, in has_leading_dir
prefix, rest = split_leading_dir(path)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 169, in split_leading_dir
path = str(path)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 52-53: ordinal not in range(128)

Make the tags uniform and easy to use for ansible.

My proposal is to manage 3 tags.

  1. setup - to setup the ec2 instance (aptitude update, psql, nginx installations etc. )
  2. configure - copy configs/certs related to nginx, psql etc.
  3. deploy - Only for deployments

Current situation is we need to run fab --skip-tags deploy to configure/setup the machine and then --tags deploy to deploy/run the code which becomes inconsistent sometimes when setting up new machine by a new dev/devop.

OSError("Error locating graphviz.")

Installed the Fueled Django Cookiecutter app for 3 times. A lot of dependencies that are not mentioned at all. But now I'm almost through the whole installation and got the following error:

File "/Users/pauloostenrijk/webprojects/chat-whitelabel-web/venv/build/pygraphviz/setup.py", line 91, in <module>

raise OSError("Error locating graphviz.")

I don't know where we use it for, but it is giving me a lot of problems.

Ansible do not gather_facts for OS

As we are opinionated about most of the things and our ansible roles are written particularly for ubuntu, I think we should disable gathering of facts by ansible. When ansible does that, it requires python and aptitude on remote server and those are not available in ubuntu16 by default.

There are one or two uses of variables provided ansible gathered facts command(like {{ ansible_distribution_release }}). We can remove those

Replace fabric with Makefile

fabric depends on pycrypto which is very hard to install on mac machine, if you don't have proper version of gcc installed.

Makefile is platform independent.

PS: Fabric was added initially because we needed to deploy to remote machine. The remote machine deployment is now handled via Ansible.

Use wheel>0.26.0

By default, in most configurations, we will get wheel==0.24.0 from parent python environment. This creates warning while installing packages like hiredis and new-relic(in production requirements). We should use atleast 0.26.0 version atleast.

Add letsencrypt ansible configuration

  • should have a feature toggle in ansible
  • should install itself un-attended or have proper configuration guide.
  • should have autorenewal script and cron.

Django security warnings

In our production settings, we are receiving following warning related to security:

  • (security.W009) Your SECRET_KEY has less than 50 characters or less than 5 unique characters. Please generate a long and random SECRET_KEY, otherwise many of Django's security-critical features will be vulnerable to attack.
  • (security.W017) You have 'django.middleware.csrf.CsrfViewMiddleware' in your MIDDLEWARE_CLASSES, but you have not set CSRF_COOKIE_HTTPONLY to True. Using an HttpOnly CSRF cookie makes it more difficult for cross-site scripting attacks to steal the CSRF token.

ImportError: cannot import name wraps

I am getting the following error when I try to run cookiecutter in a fresh environment.

$ cookiecutter https://github.com/Fueled/cookiecutter-django.git
Traceback (most recent call last):
File "/usr/local/bin/cookiecutter", line 7, in
from cookiecutter.cli import main
File "/Library/Python/2.7/site-packages/cookiecutter/init.py", line 10, in
from .compat import OLD_PY2
File "/Library/Python/2.7/site-packages/cookiecutter/compat.py", line 30, in
from mock import patch
File "/Library/Python/2.7/site-packages/mock/init.py", line 2, in
import mock.mock as _mock
File "/Library/Python/2.7/site-packages/mock/mock.py", line 68, in
from six import wraps
ImportError: cannot import name wraps

p.s as per answers on different forums, I have updated my mock and six library. Nothing working

TODO: new features and modules

  • add api versioning support via Accept headers (#52)
  • add test for cookiecutter renderning (#34)
  • add support for favicon.ico, robots.txt, humans.txt (@shk-fueled)
  • add django-versatileimagefield (@shk-fueled)
  • fix ansible script (https://github.com/Fueled/amigo-web/commit/2adaa65bc5b8da6a829d4a86b4f379a08a090f5f)
  • add base app with common re-usable code
  • add base users app
  • upgrade to django-rest-framwork-3.0
  • use redis for caching instead of memcache. (#35)
  • add newrelic support (#36)
  • add iSort configuration (#42)
  • use fig for isolated development environment instead of vagrant (#45)

Upgrade to django 1.10

Full release notes: https://docs.djangoproject.com/en/1.10/releases/1.10/

  • new middleware config [1]
  • log handler for django.server [2]
  • add 403_csrf.html template [3]
  • add argon password hasher as default [4]
  • check for compatibility with all third-party librarires included.

[1] https://docs.djangoproject.com/en/1.10/releases/1.10/#new-style-middleware
[2] https://docs.djangoproject.com/en/dev/releases/1.10/#runserver-output-goes-through-logging
[3] https://docs.djangoproject.com/en/dev/releases/1.10/#csrf
[4] https://docs.djangoproject.com/en/dev/topics/auth/passwords/#argon2-usage

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.