Before you lose any data, let me try to introduce a sysadmin perspective to this question.
There is only one reason we create backups: to make it possible to restore when something goes wrong, as it invariably will. As such, a proper backup system has requirements that go far beyond what git can reasonably handle.
Here are some of the issues I can foresee ...
My two cents: I do not think it is a good idea. GIT does something like "storing snapshots of a set of files at different points in time", so you can perfectly use GIT for something like that, but that doesn't mean you should. GIT is designed to store source code, so you would be missing most of its functionality, and you would be trading a lot of ...
How about making a cronjob, assuming you have shell access?
The cron daemon exists on virtually any UNIX-like system and schedules commands to run based on a description in a file called the crontab.
Each line of the file contains a set of fields to indicate the timepoints when a command shall be executed.
Your task could be either a standalone program ...
The Django docs never mentioned that a person who doesn't know what HTML/JS/CSS is about can use it. Separation of concerns is done also in the backend, where the actual action(the views) are separated from the database layer or the URL-routing logic - That allows for loose-coupling. It never means you can write views without ever understanding your models. ...
With Django on AWS, I'd look into Celery.
Celery adds asynchronous tasks and includes a scheduler, and on AWS you can configure Celery to use the Amazon Simple Queue Service as the broker (see Celery with Amazon SQS on Stack Overflow and this blog post on the subject).
You set up a Celery periodic task schedule and it'll run a configured task according to ...
Avoid any string that looks like spam.
Most Spam checking these days is Bayesian, which means that that your
message is checked using a fuzzy algorithm that tries to guess if
resembles known Spam or Ham (good) messages (mainly by checking the
frequency of common spam words and phrases).
Send individual messages to each recipient instead of copies.
I'm the author of the blog post in question. To clarify, what was meant was not that you shouldn't use the same directory to "serve files to GitHub", but rather you shouldn't do development in the same directory that your web server serves your content from.
Hope that clears things up.
I have done a lot of searching but I am still not able to figure out where exactly should I place this Python file containing all the logic.
There are a number of options, depending on what your requirements are:
Add the logic to e.g. the Image model. This is a useful option if you need to store per-image meta data in the database, and each model instance (...
Don't take this too seriously, but ...
create file name app.py with the following content:
from flask import Flask
app = Flask(__name__)
return "Hello World!"
if __name__ == "__main__":
assuming you have pip (python package installer) installed do the following:
$ pip install Flask
$ python app.py
How can I convince him that Python is a better choice?
You can't. All of your boss's complaints are trivial matters of personal preference.
He loves his curly braces. Python uses significant whitespace, which not everyone agrees with. However this is personal preference.
You can show that everyone does indentation correctly. You can find people who ...
This answer does not say which language is better, its sole purpose is to show Python code for things you said you needed from Django and tries to prove that in Python, as contrary to some other languages, you do not need frameworks to perform needed actions.
Python's "batteries included" vs. PHP
In PHP you often need a framework or separate ...
Coding standards exist in you. Not the language. You're likely feeling this way because you've looked at enough Java ...
It is a good idea to work through the official Django tutorials at djangoproject.com. These are written by some of the core developers and raise important issues regarding Python/Django/DB versions and syntax evolution. But, yes, the Polls app created in the process is rudimentary, so here are my recommendations to useful Django tutorials which involve app ...
Although there is nothing stopping you from not using a DB in Django, my advice would be: "If you don't need a full stack framework, don't use a full stack framework". Python has many excellent microframeworks that might suit your needs better.
This blog post discusses some of them: http://www.konstruktor.ee/blog/python-web-framework-roundup
My personal ...
Depends what you call 'good'.
However, while you can use django with no database, the object-relational mapper is pretty much its first and foremost advertised feature. Django was designed to produce database-backed web sites, so if you're not going to use a database you might end up dealing with a bunch of unnecessary hassle.
If your project is getting large, think of apps as reusable modules. You can separate out the functionality that is shared across your apps into its own app.
See the discussions below for more thoughts on the matter:
When to create a new app (with startapp) in
What is a Django “app” supposed to
What is an “app” in
Pro Usable on different DBMS without code customization.
Pro Makes code/DB integration easier.
Pro Additional type checking from ORM/table definitions.
Pro Facilitate db migrations.
Pro Essentially a DSL for DB integration.
Con Additional component to understand (you should understand how the ORM will create the SQL)
Con Any SQL customizations eliminate ...
Windows is a second class citizen in most open source communities because it treats them as second class citizens. Development and sysadmin on Windows is unnecessarily painful, especially for people who are used to Unix-based systems.
That said, Python on Windows works very well and Django doesn't do anything particularly abnormal so I don't see why you ...
I've only skimmed the requirements, but I'd be thinking something simple like this:
Give each task a letter.
Generate a task sequence string (eg, EBDFA) for a user.
Look at the first letter to decide what task to do next.
Carry out that task.
Strip the first letter off, pass the rest in the URL.
Go to step 3.
Keep it simple. Don't create models you don't ...
One difference is that cond1 only gets evaluated once in the first code snippet, but can get evaluated twice in the second example if mod2 is false. If cond1 has side effects, that changes the semantics. If cond1 is expensive to evaluate, that could also be a problem even if the semantics don't change.
If neither of those conditions are true, it's largely a ...
No, it's not.
Think about it, where would you ever need them?
Not when you create the model: you know what model are you creating.
Not inside the model itself: you know where you are too.
Nor when accessing the model later: you still know the type of the model, unless you don't care about the type, in which case prefixes will be only an annoyance.
Using a column per question makes it difficult to add more questions later.
Instead, model the relation between users and questions in your table. I.e. the questions are encoded explicitly as data, not implicitly in the structure of your table.
The table would have user_id and question_id columns, likely both with foreign key constraints to another table. ...
Python has a built-in mechanism for that: docstrings. Example:
>>> import django.forms
Help on class ModelForm in module django.forms.models:
| Method resolution order:
Since your AWS instance runs Linux, you can probably accomplish this as a cron job.
You could take what I would term Drupal's cron approach which, in the case of Django, involves creating a controller to respond to a URL and then perform the action you want.
You then configure a cron task to curl the controller's URL, triggering your script.
This has the ...
You are looking at a descriptor. Descriptors are special types of objects that can alter their behaviour when bound to a Python class or instance. They give you a hook into class and instance attribute interactions (setting, getting and deleting).
Python functions and the property decorator are descriptors. Functions have a __get__ method that returns a ...
Personally, I don't think it's a good idea to use a source control version system to store the backup files, because the GIT version control is designed for data files, not for binaries or dump files like a MySQL backup dump file. The fact that you can do it doesn't mean automatically that you should do it. Moreover, your repository, considering a new ...
To list the user departments
Use GET /users/<id>/departments, instead of returning this info in the users resource.
Doing so allow the below topics to work well in the most RESTful manner - the user-departments relation will always be available under /users/<id>/departments, instead of sometimes available under /users/<id>.
To assign an ...
You're right, the behavior is indeed strange. A null and an empty array are, semantically, two different things.
An empty array indicates exactly that: the array exists but contains no elements right now, given the query parameters.
An HTTP 404 indicates, on the other hand, that there is no array; for some reason, it makes no sense to have an array there.
Your framework choices strongly influence the architecture your applications will have. Many of the architectural decisions have already been made by the framework for you, so trying to impose your own architecture over that would be like swimming against the current.
But this is kind of the whole point of choosing a framework. Developing a suitable ...