sudo apt-get install python3-pip
sudo pip3 install virtualenv
| (r'^articles/(?P<year>\d{4}/?$, 'main.views.year'), | |
| # When a use case comes up that a month needs to be involved as | |
| # well, you add an argument in your regex: | |
| (r'^articles/(?P<year>\d{4}/(?P<month>\d{2})/?$, 'main.views.year_month'), | |
| # That works fine, unless of course you want to show something | |
| # different for just the year, in which case the following case can be | |
| # used, making separate views based on the arguments as djangoproject |
| Backup: | |
| docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
| Restore: | |
| cat your_dump.sql | docker exec -i your-db-container psql -Upostgres |
Create a scrapy exporter on the root of your scrapy project, we suppose the name of your project is my_project, we can name this exporter: my_project_csv_item_exporter.py
from scrapy.conf import settings
from scrapy.contrib.exporter import CsvItemExporter
class MyProjectCsvItemExporter(CsvItemExporter):
def __init__(self, *args, **kwargs):
delimiter = settings.get('CSV_DELIMITER', ',')| Go to Bitbucket and create a new repository (its better to have an empty repo) | |
| git clone git@bitbucket.org:abc/myforkedrepo.git | |
| cd myforkedrepo | |
| Now add Github repo as a new remote in Bitbucket called "sync" | |
| git remote add sync git@github.com:def/originalrepo.git | |
| Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync" | |
| git remote -v |
| # Use Python 3 for easy unicode | |
| $ virtualenv -p python3 .env | |
| $ source .env/bin/activate | |
| $ pip install django | |
| $ deactivate | |
| # Start new django project and app | |
| $ django-admin.py startproject mysite | |
| $ ./manage.py migrate | |
| $ ./manage.py createsuperuser |
| [diff] | |
| tool = diffmerge | |
| [difftool "diffmerge"] | |
| cmd = diffmerge \"$LOCAL\" \"$REMOTE\" | |
| [merge] | |
| tool = diffmerge | |
| [mergetool "diffmerge"] | |
| cmd = "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\"" | |
| trustExitCode = true |
In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.
The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.
| # Example logging configuration that will restrict console logging to | |
| # at most 2 repeated messages per 30 seconds. | |
| LOGGING = { | |
| 'version': 1, | |
| 'disable_existing_loggers': True, | |
| 'formatters': { | |
| 'simple': { | |
| 'format': '%(asctime)s - %(name)s - %(levelname)s - %(filename)s:%(lineno)d - %(message)s' | |
| }, | |
| }, |