mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-06-04 05:33:09 +03:00
Adding support for maildump for local development (replaces the nice, but not friendly console email handler)
This commit is contained in:
parent
265d14b645
commit
a103eaa93e
{{cookiecutter.repo_name}}
|
@ -21,7 +21,8 @@ module.exports = function (grunt) {
|
||||||
fonts: this.app + '/static/fonts',
|
fonts: this.app + '/static/fonts',
|
||||||
images: this.app + '/static/images',
|
images: this.app + '/static/images',
|
||||||
js: this.app + '/static/js',
|
js: this.app + '/static/js',
|
||||||
manageScript: 'manage.py'
|
manageScript: 'manage.py',
|
||||||
|
mailserverpid: 'mailserver.pid',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -82,7 +83,13 @@ module.exports = function (grunt) {
|
||||||
},
|
},
|
||||||
runDjango: {
|
runDjango: {
|
||||||
cmd: 'python <%= paths.manageScript %> runserver'
|
cmd: 'python <%= paths.manageScript %> runserver'
|
||||||
}
|
},
|
||||||
|
runMailDump: {
|
||||||
|
cmd: 'maildump -p <%= paths.mailserverpid %>'
|
||||||
|
},
|
||||||
|
stopMailDump: {
|
||||||
|
cmd: 'maildump -p <%= paths.mailserverpid %> --stop'
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -98,4 +105,12 @@ module.exports = function (grunt) {
|
||||||
grunt.registerTask('default', [
|
grunt.registerTask('default', [
|
||||||
'build'
|
'build'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask('start-email-server', [
|
||||||
|
'bgShell:runMailDump'
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask('stop-email-server', [
|
||||||
|
'bgShell:stopMailDump'
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|
|
@ -127,6 +127,25 @@ To run a celery worker:
|
||||||
Please note: For Celerys import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right.
|
Please note: For Celerys import magic to work, it is important *where* the celery commands are run. If you are in the same folder with *manage.py*, you should be right.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
Email Server
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
In development, it is often nice to be able to see emails that are being sent from your application. For this purpose,
|
||||||
|
a Grunt task exists to start an instance of `maildump`_ which is a local SMTP server with an online interface.
|
||||||
|
|
||||||
|
Make sure you have nodejs installed, and then type the following::
|
||||||
|
|
||||||
|
$ grunt start-email-server
|
||||||
|
|
||||||
|
This will start an email server. The project is setup to deliver to the email server by default. To view messages
|
||||||
|
that are sent by your application, open your browser to http://127.0.0.1:1080
|
||||||
|
|
||||||
|
To stop the email server::
|
||||||
|
|
||||||
|
$ grunt stop-email-server
|
||||||
|
|
||||||
|
The email server listens on 127.0.0.1:1025
|
||||||
|
|
||||||
It's time to write the code!!!
|
It's time to write the code!!!
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,6 @@ SECRET_KEY = env("DJANGO_SECRET_KEY", default='CHANGEME!!!')
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
EMAIL_HOST = 'localhost'
|
EMAIL_HOST = 'localhost'
|
||||||
EMAIL_PORT = 1025
|
EMAIL_PORT = 1025
|
||||||
EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND',
|
|
||||||
default='django.core.mail.backends.console.EmailBackend')
|
|
||||||
|
|
||||||
# CACHING
|
# CACHING
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -10,3 +10,6 @@ django-debug-toolbar==1.3.2
|
||||||
|
|
||||||
# improved REPL
|
# improved REPL
|
||||||
ipdb==0.8.1
|
ipdb==0.8.1
|
||||||
|
|
||||||
|
# maildump
|
||||||
|
maildump==0.5.1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user