Just for me to remember the steps needed
from django import http | |
try: | |
from django.conf import settings | |
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS | |
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS | |
XS_SHARING_ALLOWED_HEADERS = settings.XS_SHARING_ALLOWED_HEADERS | |
XS_SHARING_ALLOWED_CREDENTIALS = settings.XS_SHARING_ALLOWED_CREDENTIALS | |
except AttributeError: | |
XS_SHARING_ALLOWED_ORIGINS = '*' |
###Redux Egghead Video Notes###
####Introduction:#### Managing state in an application is critical, and is often done haphazardly. Redux provides a state container for JavaScript applications that will help your applications behave consistently.
Redux is an evolution of the ideas presented by Facebook's Flux, avoiding the complexity found in Flux by looking to how applications are built with the Elm language.
####1st principle of Redux:#### Everything that changes in your application including the data and ui options is contained in a single object called the state tree
Hopefully this will answer "How do I setup or start a Django project using REST Framework and ReactJS?"
This is a guide to show you step by step how this can be setup. If you just want to get started, use the cookiecuter I set up cookiecutter-django-reactjs. It basically is a fork of pydanny's cookiecutter, just added the front-end stuff :).
I created this because it was SUCH a pain in the ass setting up a project using all the latest technologies. After some research, I figured it out and have it working. The repo that implements this is located here. Feel free to use it as a boilerplate ;)
Main features:
- Django REST APIs
# Django | |
django | |
# Configuration | |
dj-database-url | |
python-decouple | |
whitenoise | |
# Django 3rd party modules | |
djangorestframework |
var path = require('path'); | |
var webpack = require('webpack'); | |
var BundleTracker = require('webpack-bundle-tracker') | |
module.exports = { | |
context: __dirname, | |
devtool: null, | |
entry: '../static/js/index', | |
output: {}, | |
plugins: [], |
var webpack = require('webpack') | |
var WebpackDevServer = require('webpack-dev-server') | |
var config = require('./webpack.local.config') | |
new WebpackDevServer(webpack(config), { | |
publicPath: config.output.publicPath, | |
hot: true, | |
inline: true, | |
historyApiFallback: true | |
}).listen(3000, '0.0.0.0', function (err, result) { |
// Karma configuration | |
var webpackConfig = require('./webpack.local.config.js'); | |
webpackConfig.entry = {}; | |
module.exports = function(config) { | |
config.set({ | |
// base path that will be used to resolve all patterns (eg. files, exclude) | |
basePath: '', |
import expect from 'expect'; | |
describe('Something abstract', () => { | |
it('works', () => { | |
expect(1).toEqual(1); | |
}); | |
}); |