I was working on a Django project and it took me some time to make Django work with Apache2. So I thought I would create a Docker project for this setup. You can find the project at https://github.com/ramkulkarni1/django-apache2-docker. It sets up Python3, Django, Apache2 and a sample Django site too.
All configurations for making Django work with Apache2 are created when you create a Docker container using this project. Simply run following command from the project folder.
$ docker-compose up
(See my post Docker Notes on information about setting up Docker and docker commands). One the container is up, browse to http://localhost:8005.
Here is a quick summary of what Dockerfile does – Continue reading “Docker project for Python3, Djaongo and Apache2 setup”
I recently started using Docker and am very impressed with how easily you can set up environment to develop, test and deploy applications. It provides a virtualization environment, but unlike some of the other virtualization solution, Docker container (runtime environment for your application) is a process instead of a complete OS. It runs natively on Linux and uses a single virtual machine on Windows and Mac in which Docker containers run.
Using Docker you can easily create containers required for your application to run, for example containers for database, application server etc and easily deploy them to test or production environment. You can create images of your set-up and re-create the same setup constantly from those images. When you create a Docker image, it has to be based on some variant of Linux base image. You can browse Docker images at Docker Hub.
This post is not meant to be tutorial or detailed information about Docker. You can refer to Docker web site for that. As many of my other posts, this post is meant to be reference for me – about some of the Docker commands I have used so far. Continue reading “Docker Notes”
This post is not meant to be tutorial on Webpack, I just wanted to describe how to configure Webpack, specifically using Webpack loaders for Bablel and ReactJS. I will show how to build a JS project using standalone Webpack and also using Webpack APIs in Gulp. The project is available on Github at https://github.com/ramkulkarni1/WebpackBlitzReactStarter
Node packages required to build the project are, of course, in package.json. If you are using above starter project from Github, then run ‘npm install’ to install all the required packages. Else make sure you install all the packages listed in devDependencies of package.json . The list contains babel, required babel presets for ES6 and ReactJS, webpack and webpack-dev-server, webpack loaders for babel, LESS and CSS.
Webpack configuration is specified in webpack.config.js. This config file is read when you run webpack or webpack-dev-server command. Optional gulpfile.js (to build the project using Gulp) also loads this file and passes to Webpack APIs.
Here is a brief description of some of the entries in the config file – Continue reading “Setting up Webpack + Babel + ReactJS”
I wanted to create this post shortly after the last post about Setting up ES6+Babel+Gulp, but it got delayed for some reasons. Anyways ..
Though it is not very complicated to setup ReactJS to work with Babel, there are a few non-obvious things you need to be aware of, specifically the absence of auto-binding in ReactJS when coded in ES6. Let’s create a small NodeJS project using Gulp –
Install following packages –
npm install gulp gulp-connect vinyl-source-stream browserify babelify babel-preset-es2015 react react-dom babel-preset-react --save-dev
In addition to packages installed in the last post, here we are installing react, react-dom and babel-preset-react packages.
The directory structure is similar to one in the previous post, except that we add views folder for JSX files.
Gulp ‘build’ task is modified to add ‘react’ preset to babelify and add jsx extension to browserify (we want browserify to process .jsx files in addition to .js files) Continue reading “Using ReactJS with Babel and ES6”
ECMAScript 6 (ES6, specification at http://www.ecma-international.org/ecma-262/6.0/) has many nice features, but presently not all browsers support ES6. However you can still develop your applications in ES6 and make it run in all browsers. For this you need what is called as transpiler – which converts ES6 code to ES5, which all browsers understand currently.
One of the popular transpiler is Babel . In this post we will see how to use Node.js (https://nodejs.org/), Gulp.js (https://gulpjs.com/), Browserify (http://browserify.org/) to compile ES6 code to ES5.
Gulp is a build tool for Node.js applications. Browserify resovles ‘require’ modules of Node.js and bundles all modules in one file. We will first use browserify to combine all our JS code in one file and then feed the output to babelify to translate the code to ES5. Structure of this sample project is as follows –
Not all the files are folders are shown above, for example package.json and node_modules folder are not shown.
Continue reading “Setting up ES6+Babel+Gulp”
Packt Publishing is having Thanksgiving sale from the 26th to the 30th of November, where their entire catalogue of e-books and videos are being offered for 50% off.
As part of this sale you can now get 50% off on my book – Java EE Development with Eclipse – Second Edition.
My second book “Java EE Development with Eclipse – Second Edition” has been published. One of the reasons I did not post much on the blog was this book. I had been working on the book for the past few months and I am very glad that it has been published now.
One of the challenges writing this book was the diverse topics that it covered – Servlets, JSP, JSF, JDO, EJB, JSM, SOAP, REST, Spring, Unit Testing, Debugging and trouble shooting performance and memory issues in Java applications. Separate books could be written, and books have been written, on some of these topics.
This book explains how to develop applications using these technology in Eclipse IDE. The focus is not just on how to use different technologies in JEE, but also on setting up development environment, testing, debugging and deploying applications developed using these technologies.
The book is available on the publisher’s site at bit.ly/1GryrTd.
As at the end of past couple of years, WrodPress has created annual report of my blog activities. The report is available at http://jetpack.me/annual-report/33403624/2014/.
Some of the highlights are –
Unfortunately I did not get much time to blog in the last three months. I had many topics on which I wanted to write on, but the work schedule was quite hectic. I hope to write on those topics in the coming months.
I spent a couple of hours today trying to figure out how to configure Apache Web Server on Mac OS X to execute Python scripts, so I thought I would document the process for my own reference.
OS X is preinstalled with Apache and Python. Apache executable (apachectl) is at /usr/sbin/apachectl and Python is at /usr/bin/python. But the configurations for Apache are at /etc/apache2, specifically in the file httpd.conf. If you open the file and look for DocumentRoot, you will find that default document root is set to /Library/WebServer/Documents.
I did not want to change the default doc root but at the same time did not want to store my scripts in the default folder. I could have created a virtual host or an alias. I decided to do the later because it is simpler than creating virtual host; and I was configuring Python for development only. So just below the document root setting I added the alias – Continue reading “Configuring Apache on Mac OS X (Mavericks) for Python scripting”