How do I run a Node.js application as its own process?

2016 answer: nearly every Linux distribution comes with systemd, which means forever, monit, PM2, etc. are no longer necessary – your OS already handles these tasks. Make a myapp.service file (replacing ‘myapp’ with your app’s name, obviously): [Unit] Description=My app [Service] ExecStart=/var/www/myapp/app.js Restart=always User=nobody # Note Debian/Ubuntu uses ‘nogroup’, RHEL/Fedora uses ‘nobody’ Group=nogroup Environment=PATH=/usr/bin:/usr/local/bin Environment=NODE_ENV=production … Read more

How to deploy correctly when using Composer’s develop / production switch?

Why There is IMHO a good reason why Composer will use the –dev flag by default (on install and update) nowadays. Composer is mostly run in scenario’s where this is desired behavior: The basic Composer workflow is as follows: A new project is started: composer.phar install –dev, json and lock files are commited to VCS. … Read more

IIS7 deployment – duplicate ‘system.web.extensions/scripting/scriptResourceHandler’ section

If your plan is to deploy to an IIS that has an Application Pool running in .net 4.0 you will need to cleanup the web.config that includes all the section Definitions that point to .net 3.5. The reason this fails is because these section definitions are already included in the root web.config in .NET 4.0 … Read more

How do I install package.json dependencies in the current directory using npm

Running: npm install from inside your app directory (i.e. where package.json is located) will install the dependencies for your app, rather than install it as a module, as described here. These will be placed in ./node_modules relative to your package.json file (it’s actually slightly more complex than this, so check the npm docs here). You … Read more

Create a directly-executable cross-platform GUI app using Python

First you will need some GUI library with Python bindings and then (if you want) some program that will convert your python scripts into standalone executables. Cross-platform GUI libraries with Python bindings (Windows, Linux, Mac) Of course, there are many, but the most popular that I’ve seen in wild are: Tkinter – based on Tk … Read more

How to manage local vs production settings in Django?

Two Scoops of Django: Best Practices for Django 1.5 suggests using version control for your settings files and storing the files in a separate directory: project/ app1/ app2/ project/ __init__.py settings/ __init__.py base.py local.py production.py manage.py The base.py file contains common settings (such as MEDIA_ROOT or ADMIN), while local.py and production.py have site-specific settings: In … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)