Tag Info

Hot answers tagged

66

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 ...


42

First learn Python well Here are some online resources for learning Python The Python Tutorial Wiki-Book Byte of Python Building Skills in Python Version 2.5 Python Free Online Ebooks Python Bibliotheca Think Python Data Structures and Algorithms in Python How to Think Like a Computer Scientist: Learning with Python Python for Fun Invent Your Own ...


33

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 ...


29

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 ...


18

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 ...


16

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.


15

Disclaimer 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 ...


14

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 ...


14

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 ...


13

Python is about as easy to learn as a language could be, which is one of the main selling points of the language. As someone that is very experienced in OO languages, you are in a great position to start. The only fundamental differences between Python and Java/C# are Duck-typing / lack of type safety. First class functions. I understand why you feel ...


11

Yes, the Django forms is a mess from the MVC perspective, suppose you are working in a big MMO super-hero game and you are creating the Hero model: class Hero(models.Model): can_fly = models.BooleanField(default=False) has_laser = models.BooleanField(default=False) has_shark_repellent = models.BooleanField(default=False) Now you are asked to ...


10

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 ...


9

I don't know Django, but do know IntraWeb. You indicate you want to create a kind of data-entry application. For that IntraWeb is suited as it is meant for writing web applications, not for web-sites, and it uses the same concept as a regular Delphi VCL application: a form designer, with a Delphi unit underneath that has the code. So if you know how to ...


9

ORM 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 ...


9

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 ...


8

As an embedded C programmer who ended up working on a Python/Django web app as a skunk-works project I can testify that the basics are easy to pick up. Python generally is very straightforward to get to grips with. I've personally not found the python documentation itself very useful - it always seems more like an aide memoir for someone who already knows ...


8

The one overriding principle: getting humans to write XML is evil.


8

JSON should just contain the data and no markup. In the long run this approach is more extensible because there is potential for using the JSON data in other parts of your site. If you include markup then using the same data to populate another template becomes much harder.


8

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.


8

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 ...


8

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 ...


8

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 ...


7

If Web development in python is what you are looking for, then after a thorough understanding of python , I suggest that you have a look at Flask. Django and other full stack frameworks would definitely make your life much much easier but overall would leave you with an incomplete feeling as if you have not learnt much. Flask IMHO , is the most awesome ...


7

Don't take this too seriously, but ... create file name app.py with the following content: from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run() assuming you have pip (python package installer) installed do the following: $ pip install Flask $ python app.py * ...


7

Python has a built-in mechanism for that: docstrings. Example: >>> import django.forms >>> help(django.forms.ModelForm) Help on class ModelForm in module django.forms.models: class ModelForm(BaseModelForm) | Method resolution order: | ModelForm | BaseModelForm | django.forms.forms.BaseForm | ...


6

When asked Can you provide a link or a quote that specifically confuses you? – S.Lott you answered databases, views, and all those stuff... I only started playing with frameworks after I had done a fair amount of development without a framework. I can grok what the framework is doing for me because I know that "view" refers to something in the ...


6

I may be incorrect but I've been using django for over a year now and never found such a guide. Slightly unfortunate - I would like to have a function reference like you mentioned. However, as an additional resource the http://www.djangobook.com/ is very good. I've always considered building one, but I'm very lazy. There is also another reference you may ...


6

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. ...


6

I think you're looking for the SQL ANSI standard. This standard is implemented in most RDBMS for the biggest part. However, every RDBMS decided to do some things their way. (Simply because the standard didn't have the feature or another reason. LIMIT has an equivalent since SQL:2008 only for example.) Listing these differences from the SQL standard would ...


6

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 ...



Only top voted, non community-wiki answers of a minimum length are eligible